我想扩展 System.Data.DataRow 类,所以我做了以下代码(并using
在我的类中添加了关键字)
namespace MyExtension
{
public static class DataRowExt
{
public static string ToNullableDate(this DataRow dr)
{ return something;}
}
}
但是,当我尝试以下代码ToNullableDate
时,Intellisense 中没有显示:
DataRow d = new DataRow();
d["Column"].ToNullableDate(); // ToNullableDate does not show up
我的扩展方法声明中是否缺少任何内容?还是应该只创建一个新类并从 DataRow 类继承?
谢谢