共用方式為


編譯器錯誤 CS1676

更新:2007 年 11 月

錯誤訊息

參數 'number' 必須以 'keyword' 關鍵字宣告

當匿名方法中的參數型別修飾詞與方法所轉型的委派宣告中所使用的修飾詞不同時,便會發生這個錯誤。

下列範例會產生 CS1676:

// CS1676.cs
delegate void E(ref int i);
class Errors 
{
   static void Main()
   {
      E e = delegate(out int i) { };   // CS1676
      // To resolve, use the following line instead:
      // E e = delegate(ref int i) { };
   }
}