컴파일러 오류 CS0662

업데이트: 2007년 11월

오류 메시지

'method'은(는) ref 매개 변수에 Out 특성만 지정할 수는 없습니다. In 및 Out 특성을 모두 사용하거나 둘 다 사용하지 마십시오.
'method' cannot specify only Out attribute on a ref parameter. Use both In and Out attributes, or neither.

인터페이스 메서드에 있는 ref를 사용하는 매개 변수에 Out 특성만 있습니다. Out 특성을 사용하는 ref 매개 변수에는 In 특성도 사용해야 합니다.

다음 샘플에서는 CS0662 오류가 발생하는 경우를 보여 줍니다.

// CS0662.cs
using System.Runtime.InteropServices;

interface I
{
   void method([Out] ref int i);   // CS0662
   // try one of the following lines instead
   // void method(ref int i);
   // void method([Out, In]ref int i);
}

class test
{
   public static void Main()
   {
   }
}