.net framework 2.0使用扩展方法
.net framework中使用扩展方法,由网摘上看到,是因为编译器将扩展方法带上了ExtensionAttribute特性
要在.net framework 2.0中使用的话,可以自定义一个特性:
- namespace System.Runtime.CompilerServices
- {
- public class ExtensionAttribute : Attribute { }
- }
这样不引用.net framwork 3.5程序集,也可以使用扩展方法