Share via


컴파일러 오류 CS1007

업데이트: 2007년 11월

오류 메시지

속성 접근자가 이미 정의되었습니다.
Property accessor already defined

속성을 선언할 때에는 속성의 접근자 메서드도 선언해야 합니다. 그러나 속성에 get 접근자 메서드나 set 접근자 메서드를 여러 개 지정할 수는 없습니다.

예제

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

// CS1007.cs
public class clx
{
    public int MyProperty
    {
        get
        {
            return 0;
        }
        get   // CS1007, this is the second get method
        {
            return 0;
        }
    }

    public static void Main() {}
}