Newbie question: if I am mistaken, most attributes seem to be benign until you use reflection during assembly (s) or classes to detect and act on the attributes. I noticed that ObsoleteAttribute seems unique in .NET attributes, where it can dynamically raise warnings and errors at compile time:
[Obsolete("don't use", false)] public string Name { get; set; }
I have a question how to do this? Is this something embedded in the compiler since the corresponding warning message number seems specific to ObsoleteAttribute? I google'd and cannot find any obvious answers. I know with C ++ and a combination of great macros, you can force C ++ to generate warnings and errors on demand, but how does C # do this? Thanks...
Barry source share