Export (0) Print
Expand All
Expand Minimize

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()
    {
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft