I'd like to know whether I can retrieve an argument name from an argument value. I need this functionality because I've build myself a static class (called Requires) to make argument checking in method bodies a one-liner. Currently, the validation methods are implemented like this:
Requires.StringNotNullOrEmpty(string argName, string argValue) {...}
To validate an argument, you have to provide the name of the argument (later used to throw a meaningful ArgumentException) and its value.
My question is, is there a way to retrieve the argument name from an argument value inside a method body?
Thanks in advance and happy easter!