共用方式為


編譯器錯誤 CS1677

更新:2007 年 11 月

錯誤訊息

參數 'number' 不得以 'keyword' 關鍵字宣告

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

範例

下列範例會產生 CS1677:

// CS1677.cs
delegate void D(int i);
class Errors
{
    static void Main() 
    {
        D d = delegate(out int i) { };   // CS1677
        // To resolve, use the following line instead:
        // D d = delegate(int i) { };

        D d = delegate(ref int j){}; // CS1677
        // To resolve, use the following line instead:
        // D d = delegate(int j){};
    }
}