ArgSentry is a .NET / .NET Core utility library for validating method argument values.
/// <summary>
/// Does something useless...but safely.
/// </summary>
/// <param name="nonNullObj">A required, non-null object.</param>
/// <param name="positiveNumber">A positive number.</param>
/// <param name="requiredString">A required, non-null, non-empty, non-white space string.</param>
/// <param name="nonEmptyList">A required non-null, non-empty collection.</param>
/// <param name="nonEmptyGuid">A non-empty GUID.</param>
/// <returns></returns>
public bool DoSomething(
object nonNullObj,
int positiveNumber,
string requiredString,
List<string> nonEmptyList,
Guid nonEmptyGuid)
{
Prevent.NullObject(nonNullObj, nameof(nonNullObj));
Prevent.ValueLessThanOrEqualTo(positiveNumber, 0, nameof(positiveNumber));
Prevent.NullOrWhiteSpaceString(requiredString, nameof(requiredString));
Prevent.NullOrEmptyCollection(nonEmptyList, nameof(nonEmptyList));
Prevent.EmptyGuid(nonEmptyGuid, nameof(nonEmptyGuid));
return true;
}