Saturday, May 16, 2009

IsNullOrEmptyOrNoValue() - Extension of IsNullOrEmpty()

public static bool IsNullOrEmptyOrNoValue(string strValue)
{

return (string.IsNullOrEmpty(strValue) ? true : (string.IsNullOrEmpty(strValue.Trim()) ? true : false));

}

Parameters
value
Type: System.String
A String reference.

Return Value
Type: SystemBoolean

true if the value parameter is a null reference (Nothing in Visual Basic) or an empty string (""); or the trim value is empty otherwise, false.

Remarks
IsNullOrEmpty is a convenience method that enables you to simultaneously test whether a String is a null reference (Nothing in Visual Basic) or its value is Empty or the trim value is empty.


No comments: