Compiler Warning (level 1) CS3011
TOC
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

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 Writing CLS-Compliant Code and Common Language Specification.

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()
    {
    }
}
Show:
© 2016 Microsoft