I have this
public static class Parameters
{
public static void Required(this T parameter, string paramName) where T : class
{
if (param
You could make the Requred-function accepting a Expression. And from the expression you can read out the name of the member name. It's descriped here.
public static void Required<T>(Expression<Func<T>> parameter) where T : class
{
if (parameter.Compile().Invoke() == null)
{
var caller = ((MemberExpression)parameter.Body).Member.Name;
throw new ArgumentNullException(caller);
}
// ...
}
and call it like this:
Parameters.Required(() => settings);