Share via


컴파일러 오류 CS1667

업데이트: 2007년 11월

오류 메시지

'attribute' 특성은 속성 또는 이벤트 접근자에 사용할 수 없습니다. 'declaration type' 선언에만 사용할 수 있습니다.
Attribute 'attribute' is not valid on property or event accessors. It is valid on 'declaration type' declarations only.

특성을 속성 또는 이벤트 자체에 대해 사용해야 하는 경우에 속성 또는 이벤트 접근자에 대해 사용하면 이 오류가 발생합니다. 이 오류는 CLSCompliantAttribute, ConditionalAttributeObsoleteAttribute 특성에 발생할 수 있습니다.

예제

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

// CS1667.cs
using System;

public class C
{
    private int i;

    //Try this instead:
    //[Obsolete]
    public int ObsoleteProperty
    {
        [Obsolete]  // CS1667
        get { return i; }
        set { i = value; }
    }

    public static void Main()
    {
    }
}