编译器错误 CS1728
更新:2007 年 11 月
错误消息
无法将委托绑定到作为“type”成员的“member”
无法将委托绑定到 Nullable 类型的成员。
示例
下面的示例生成 CS1728:
// CS1728.cs
class Test
{
delegate T GetT<T>();
delegate T GetT1<T>(T t);
delegate bool E(object o);
delegate int I();
delegate string S();
static void Main()
{
int? x = null;
int? y = 5;
GetT<int> d1 = x.GetValueOrDefault; // CS1728
GetT<int> d2 = y.GetValueOrDefault; // CS1728
GetT1<int> d3 = x.GetValueOrDefault; // CS1728
GetT1<int> d4 = y.GetValueOrDefault; // CS1728
}
}