Share via


컴파일러 오류 CS0177

업데이트: 2007년 11월

오류 메시지

제어가 현재 메서드를 벗어나기 전에 'parameter' out 매개 변수를 할당해야 합니다.
The out parameter 'parameter' must be assigned to before control leaves the current method

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);
   }
}