Edit

Share via


Compiler Warning (level 1) 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. For more information about CLS compliance, see Language independence and language-independent components.

Example

The following example generates CS3011:

// CS3011.cs  
  
using System;  
  
[assembly:CLSCompliant(true)]  
public abstract class I  
{  
    [CLSCompliant(false)]  
    public abstract int M();   // CS3011  
  
    // OK  
    [CLSCompliant(false)]  
    public void M2()  
    {  
    }  
}  
  
public class C : I  
{  
    public override int M()  
    {  
        return 1;  
    }  
  
    public static void Main()  
    {  
    }  
}