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));

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-20
  • 2022-12-23
  • 2022-12-23
  • 2021-05-04
  • 2021-04-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2021-10-31
  • 2021-05-15
  • 2021-12-05
  • 2021-05-29
相关资源
相似解决方案