This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Inspired by a Rust utility I saw posted the other day: https://www.reddit.com/r/rust/comments/13gujgg/todo_by_compiletime_lifetimes_for_comments/
I don't know anything about Rust, but I've recently dived into attributes in .NET and figured I could probably recreate the experience in .NET:
Behold: https://imgur.com/a/SR28yPc
Behind the scenes, the code grabs the method that triggered enforcement (this method can be called anywhere in the code base, does not need to be called by a method decorated with an attribute), looks up the associated assembly, loops over all available methods marked with a specific attribute, then evaluates each attribute and throws an exception if the evaluation fails (a date or version number has elapsed, for example). I know that's not super-performant, but the idea would be enforcement would be a one-time check in the entrypoint to a program.
Post Details
- Posted
- 1 year ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/csharp/comm...