The only attribute that can cause the compiler to generate an error is the ObsoleteAttribute
. It is because this attribute's behavior is hard-coded into the compiler.
Attributes like the NotNull
attribute are generally meant for tools (like ReSharper) to generate warnings or errors while writing code. Please read about this particular attribute here.
You can also use tools like PostSharp to issue additional build-time errors.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…