共用方式為


編譯器錯誤 CS1728

更新:2007 年 11 月

錯誤訊息

無法將委派繫結至 'member',因為它是 'type' 的成員

您無法將委派繫結至 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
   }
}