EqualsByValue

        public static bool EqualsByValue(this string inString, string compared)
        {
            if (string.IsNullOrEmpty(inString) && string.IsNullOrEmpty(compared))
                return true;

            // If we get here, then "compared" necessarily contains data and therefore, strings are not equal.
            if (inString == null)
                return false;

            // Turn down to standard equality check.
            return inString.Equals(compared);
        }
Example:
bool areEqual = a.EqualsByValue(b);

Description

Determines whether two String objects have the same value. Null and String.Empty are considered equal values.

Details

Double click on the code to select all.

 

;