Hacker News new | past | comments | ask | show | jobs | submit
The only case I've used them was to mark classes that I need to find via reflection and do something with them. For example a migration system where you want to load all migrations that are defined and check if you need to run them. Of course you don't really need an attribute for that, but I find it helpful to leaven a marker on the class that there's something else going on there.
To solve this problem I have seen the following pattern:

1. Create an abstract base class named MigrationBaseClass 2. Have all migrations classes inherit from MigrationBaseClass 3. Use .Net Reflection to get all types that inherit from MigrationBaseClass 4. Do something with these types.

loading story #48372461
loading story #48373124
loading story #48372510
FastEndpoints does this for you with Validators as an example... It can be abstracted cleanly.