多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# Compiler Error CS0052 可访问性不一致: 字段类型“type”比字段“field”的访问性低 字段类型的可访问性不能比字段本身的可访问性低,因为所有的公共构造都必须返回公共的可访问对象。 下面的示例生成 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() { } } ``` ## 请参阅 [C# 关键字](https://msdn.microsoft.com/zh-cn/library/x53a06bb.aspx) [访问修饰符(C# 参考)](https://msdn.microsoft.com/zh-cn/library/wxh6fsc7.aspx) [可访问性级别(C# 参考)](https://msdn.microsoft.com/zh-cn/library/ba0a1yw2.aspx) [修饰符(C# 参考)](https://msdn.microsoft.com/zh-cn/library/6tcf2h8w.aspx)