public static void NotNullOrEmpty <T>([ValidatedNotNull] IEnumerable <T> enumerable, string variableName) { ArgumentValidation.NotNull(enumerable, variableName); if (!enumerable.Any()) { throw new ArgumentException(variableName); } Contract.EndContractBlock(); }
public static TValue NotNullPassThrough <TTarget, TValue>([ValidatedNotNull] TTarget variable, string variableName, Func <TTarget, TValue> valueGetter) where TTarget : class { if (variable == null) { throw new ArgumentNullException(variableName); } ArgumentValidation.NotNull(valueGetter, "valueGetter"); Contract.EndContractBlock(); return(valueGetter(variable)); }