Share via


컴파일러 오류 CS1728

업데이트: 2007년 11월

오류 메시지

'member'은(는) 'type'의 멤버이므로 대리자를 바인딩할 수 없습니다.
Cannot bind delegate to 'member' because it is a member of '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
   }
}