컴파일러 오류 CS0052
일관성 없는 액세스 가능성: 'type' 필드 형식이 'field' 필드보다 액세스하기 어렵습니다.
모든 public 구문은 공개적으로 액세스 가능한 개체를 반환해야 하므로 필드 형식은 필드보다 액세스하기 쉬워야 합니다.
예제
다음 샘플에서는 CS0052 오류가 발생하는 경우를 보여 줍니다.
// CS0052.cs
public class MyClass2
{
// The following line causes an error because the field, M, is declared
// as public, but the type, MyClass, is private. Therefore the type is
// less accessible than the field.
public MyClass M; // CS0052
private class MyClass
{
}
// One way to resolve the error is to change the accessibility of the type
// to public.
//public class MyClass
// Another solution is to change the accessibility of the field to private.
// private MyClass M;
}
public class MainClass
{
public static void Main()
{
}
}