Compiler Error CS0577
The Conditional attribute is not valid on 'function' because it is a constructor, destructor, operator, or explicit interface implementation
Note
Destructor is a deprecated term for finalizer.
Conditional
cannot be applied to the specified methods.
For example, you cannot use some attributes on an explicit interface definition. The following sample generates CS0577:
// CS0577.cs
// compile with: /target:library
interface I
{
void m();
}
public class MyClass : I
{
[System.Diagnostics.Conditional("a")] // CS0577
void I.m() {}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: