c#扩展方法
public static class SysExtension
{
/// <summary>
/// 扩展方法事例
/// </summary>
/// <param name="src"></param>
/// <param name="decimals"></param>
/// <returns></returns>
public static double Round(this double src, int decimals)
{
return Math.Round(src, decimals);
}
}
{
/// <summary>
/// 扩展方法事例
/// </summary>
/// <param name="src"></param>
/// <param name="decimals"></param>
/// <returns></returns>
public static double Round(this double src, int decimals)
{
return Math.Round(src, decimals);
}
}
项目中的扩展方法用起来还比较方便,这是.NET3.0的特征。
给自己几个学习链接:
http://www.cnblogs.com/ldp615/archive/2009/08/07/1541404.html