다음을 통해 공유


컴파일러 오류 CS0206

업데이트: 2007년 11월

오류 메시지

속성 또는 인덱서는 out 또는 ref 매개 변수로 전달할 수 없습니다.
A property or indexer may not be passed as an out or ref parameter

따라서 속성ref 또는 out 매개 변수로 전달할 수 없습니다. 자세한 내용은 매개 변수 전달(C# 프로그래밍 가이드)를 참조하십시오.

예제

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

// CS0206.cs
public class MyClass
{
    public static int P
    {
        get
        {
            return 0;
        }
        set
        {
        }
    }

    public static void MyMeth(ref int i)
    // public static void MyMeth(int i)
    {
    }

    public static void Main()
    {
        MyMeth(ref P);   // CS0206
        // try the following line instead
        // MyMeth(P);   // CS0206
    }
}