Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0106

The modifier 'modifier' is not valid for this item

A class or interface member was marked with an invalid access modifier. For example:

  • The static and public modifiers are not permitted on interface methods.
  • The static modifier is not permitted on a class.
  • The public keyword is not allowed on an explicit interface declaration. In this case, remove the public keyword from the explicit interface declaration.
  • The abstract keyword is not allowed on an explicit interface declaration because an explicit interface implementation could never be overridden.

The following sample generates CS0106:

// CS0106.cs
namespace MyNamespace
   interface I
      void m();
      static public void f();   // CS0106

   public class MyClass
      public void I.m()   // CS0106

      public static void Main()
© 2015 Microsoft