컴파일러 오류 CS0149
업데이트: 2007년 11월
오류 메시지
메서드 이름이 필요합니다.
Method name expected
delegate를 만들 때에는 메서드를 지정하십시오. 자세한 내용은 대리자(C# 프로그래밍 가이드)를 참조하십시오.
다음 샘플에서는 CS0149 오류가 발생하는 경우를 보여 줍니다.
// CS0149.cs
using System;
delegate string MyDelegate(int i);
class MyClass
{
// class member-field of the declared delegate type
static MyDelegate dt;
public static void Main()
{
dt = new MyDelegate(17.45); // CS0149
// try the following line instead
// dt = new MyDelegate(Func2);
F(dt);
}
public static string Func2(int j)
{
Console.WriteLine(j);
return j.ToString();
}
public static void F(MyDelegate myFunc)
{
myFunc(8);
}
}