共用方式為


編譯器錯誤 CS0177

更新:2007 年 11 月

錯誤訊息

在程式控制權離開目前的方法前必須指定 out 參數 'parameter' 的值

方法主體中以 out 關鍵字標記的參數沒有指定值。如需詳細資訊,請參閱傳遞參數 (C# 程式設計手冊)

下列範例會產生 CS0177:

// CS0177.cs
public class MyClass
{
   public static void Foo(out int i)   // CS0177
   {
   // uncomment the following line to resolve this error
   //   i = 0;
   }

   public static void Main()
   {
       int x = -1;
       Foo(out x);
   }
}