特性“Attribute Name”仅对方法或特性类有效
此错误仅出现在 ConditionalAttribute 特性中。 如消息所称,此特性仅用于方法或特性类。 例如,尝试将此特性应用于类将生成此错误。
下面的示例生成 CS1689:
// CS1689.cs
// compile with: /target:library
[System.Diagnostics.Conditional("A")] // CS1689
class MyClass {}
特性“Attribute Name”仅对方法或特性类有效
此错误仅出现在 ConditionalAttribute 特性中。 如消息所称,此特性仅用于方法或特性类。 例如,尝试将此特性应用于类将生成此错误。
下面的示例生成 CS1689:
// CS1689.cs
// compile with: /target:library
[System.Diagnostics.Conditional("A")] // CS1689
class MyClass {}