Export (0) Print
Expand All
Expand Minimize

Compiler Error CS3011

'member': only CLS-compliant members can be abstract

A class member cannot be both abstract and non-compliant with the Common Language Specification (CLS). The CLS specifies that all class members shall be implemented.

The following sample generates CS3011:

// CS3011.cs
using System;
[assembly:CLSCompliant(true)]

public abstract class I
{
   [CLSCompliant(false)]
   public abstract int mf();   // CS3011

   // OK
   [CLSCompliant(false)]
   public void mf2()
   {
   }
}

public class C : I
{
   public override int mf()
   {
      return 1;
   }

   public static void Main()
   {
   }
}

See Also

What Is the Common Language Specification

Show:
© 2014 Microsoft