Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0052 

Error Message

Inconsistent accessibility: field type 'type' is less accessible than field 'field'

The type of a field cannot be less accessible than the field itself because all public constructs must return a publicly accessible object.

Example

The following sample generates CS0052:

// CS0052.cs
class MyClass
// try the following line instead
// public class MyClass
{
}

public class MyClass2
{
   public MyClass mf;   // CS0052
}

public class MyClass3
{
   public static void Main()
   {
   }
}

See Also

Community Additions

ADD
Show:
© 2014 Microsoft