• .net便利的小方法


    Server对象里的常用方法
    Server.HtmlEncode
    Server.UrlEncode
    Server.MapPath
    返回与 Web 服务器上的指定虚拟路径相对应的物理文件路径。

    ?? eg:string name= strname ?? "默认"
    解释:如果strname有值不为空,则name=strname.否则name="默认"



    Unit.Pixel(200) 得到像素单位结果 String.TrimStart(',') 去掉开头的指定字符 String.TrimEnd(',') 去掉结尾的指定字符 String.StartsWith(); String.EndsWith(); Page.IsValid 获取一个值,该值指示页所有验证是否成功。 form1.DefaultButton 设置button默认激发 页面传值: QueryString session cookie ------------ postbackurl Context ---------------------- 枚举作为下拉列表数据源 DropdownList.DataSource=enum.GetNames(typeof(枚举名称)); 内置泛型委托 Action(T) Func(T,T) //设置参数默认值 public string test(int id=1) { return id.tostring(); }

    //判断引用类型是否为空
    //当name为空时返回hello
    public string test(stirng name)
    return name ?? "hello"; 转换数组类型
    int[] ids=Array.ConvertAll(chk,x=>int32.Parse(x));
  • 相关阅读:
    面向对象编程
    json 和 pickle
    装饰器详解
    内置函数
    Python之基础知识
    Python之路---day2
    用户登录
    Python之路---day1
    js格式化数字和金额
    作用域链–JS基础核心之一
  • 原文地址:https://www.cnblogs.com/fumj/p/2578568.html
Copyright © 2020-2023  润新知