The ConditionalAttribute
can be used to remove calls to a marked method depending on the compiler symbols defined. I'm assuming we could not create this class ourselves since the compiler must be looking for it specifically.
I was wondering what other classes there are that the compiler, or language uses that we could not code ourselves.
in addition to those mentioned;
AttributeUsageAttribute
has special compiler support, since it restricts (at compile) how you can apply attributes
ObsoleteAttribute
is also used by the compiler to warn or error about usage.
I suspect though, that technically you could write all of these yourself - as long as you write your own core libarary and System.dll ;p The compiler is generally looking for a pattern/signature, since it must cater for different runtimes - and indeed you don't have to use the MS core libraries. The behaviour, however, is defined by the compiler, not the class - so you can't make it do anything different.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With