I know it’s possible, and I’ve seen simple examples in the documentation, but are they being used in the wild?
I use attributes at the class and method level all the time, but have never used them on method parameters. What are some real-world examples, and the reasons for the usage?
I’m not interested in seeing a textbook example, mind you. There are plenty of those out there. I want to see an actual reason why it solved a particular problem for you.
EDIT: Let’s place aside the discussion about whether or not to use attributes in the first place. I understand some people don’t like them because they ‘dirty’ their code. That’s for a different discussion!
You can for example create a ValidatorAttribute for every parameter, then before calling the method, you can reflect the parameter attributes and do parameter validation. Then call the method if all ok.