BuildLight.Core.CodeContracts.ParameterCheck.StringRequiredAndNotWhitespace C# (CSharp) Method

StringRequiredAndNotWhitespace() public static method

Throw a Precondition exception if the provided string is null, empty or contains only whitespace.
/// The parameter is null, empty or contains only whitespace. /// - or - /// The parameter name is null, empty or all whitespace ///
public static StringRequiredAndNotWhitespace ( string parameter, string parameterName ) : void
parameter string Teh string parameter to check.
parameterName string The name of the string parameter (used in error messages).
return void
        public static void StringRequiredAndNotWhitespace(string parameter, string parameterName)
        {
            ParameterNameRequired(parameterName);

            Require(!string.IsNullOrWhiteSpace(parameter), string.Format("The string parameter {0} must not be null, empty or contain only whitespace", parameterName));
        }