.net framework 2.0使用扩展方法

.net framework中使用扩展方法,由网摘上看到,是因为编译器将扩展方法带上了ExtensionAttribute特性

要在.net framework 2.0中使用的话,可以自定义一个特性:

  1. namespace System.Runtime.CompilerServices
  2. {
  3.     public class ExtensionAttribute : Attribute { }
  4. }

这样不引用.net framwork 3.5程序集,也可以使用扩展方法

posted @ 2015-05-20 17:51  calochCN  阅读(446)  评论(0编辑  收藏  举报