What does ConditionalAttribute on an Attribute do?
问题 I know what ConditionalAttribute does. The docs say it can also be applied to a class, if it's derived from Attribute : [Conditional("DEBUG")] public class FooAttribute : Attribute { } But how does that custom attribute behave? (Is it stripped out of a release build?) 回答1: @RicardoPontual's comment gave me an idea. I did this: [Conditional("DEBUG")] public class FooAttribute : Attribute { } [Foo] public class Bar { } I compiled in debug mode , and loaded the DLL in ILSpy (it's a disassembler)