更新:2007 年 11 月
错误消息
应输入方法名称
在创建 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);
   }
}