
What are generic attributes in C# 11?
Generic attributes increase the flexibility of a very early .NET feature. Let’s try using them and see how it keeps our code DRY.
Generic attributes increase the flexibility of a very early .NET feature. Let’s try using them and see how it keeps our code DRY.
Ever thought it’d be convenient to attach metadata to your code at design time, then read it at runtime? Attributes let you do just that - to methods, classes, tests, enumerations, and more. Use reflection to read them at runtime and take some action. Here’s a few examples for the uninitiated…
The Obsolete attribute on a class is ignored when an interface is involved. It caught me by surprise, but makes sense. Let’s see why.