首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > 其他 > useful-extention-methods

useful-extention-methods

  • 资源大小:6.50 kB
  • 上传时间:2021-06-30
  • 下载次数:0次
  • 浏览次数:1次
  • 资源积分:1积分
  • 标      签:

资 源 简 介

A growing collection of useful Extension Methods for .NET 3.5. This is a project to simply collect and create useful extension methods for use with .NET. The following example makes use of the DefaultIfNull"<"T">" extension method which provides a type safe default value if the target variable is null. With nullable types you are then guaranteed a value when you state the Value property as demoed below. ``` string s = "Not null"; decimal? val2 = 3.33M; string val3 = s.DefaultIfNull("Andy"); decimal val4 = val2.DefaultIfNull(2.22M).Value; Console.WriteLine(val3); Console.WriteLine(val4); ```

相 关 资 源

您 可 能 感 兴 趣 的

同 类 别 推 荐

VIP VIP
0.181598s