컴파일러 오류 CS0272
업데이트: 2007년 11월
오류 메시지
set 접근자에 액세스할 수 없으므로 'property/indexer' 속성 또는 인덱서를 이 컨텍스트에서 사용할 수 없습니다.
The property or indexer 'property/indexer' cannot be used in this context because the set accessor is inaccessible
이 오류는 set 접근자에서 프로그램 코드에 액세스할 수 없는 경우에 발생합니다. 이 오류를 해결하려면 접근자의 액세스 가능성을 높이거나 호출 위치를 변경합니다. 자세한 내용은 비대칭 접근자 액세스 가능성(C# 프로그래밍 가이드)를 참조하십시오.
예제
다음 예제에서는 CS0272 오류가 발생하는 경우를 보여 줍니다.
// CS0272.cs
public class MyClass
{
public int Property
{
get { return 0; }
private set { }
}
}
public class Test
{
static void Main()
{
MyClass c = new MyClass();
c.Property = 10; // CS0272
// To resolve, remove the previous line
// or use an appropriate modifier on the set accessor.
}
}