private bool Equals(BsonValue value1, BsonValue value2) { if (value1.IsString && value2.IsString) { if (_stringComparisonIgnoreWhiteSpace) { return(StringCompare.EqualsIgnoreWhiteSpace(value1.AsString, value2.AsString, _stringComparisonIgnoreCase)); } if (_stringComparisonIgnoreCase) { return(string.Equals(value1.AsString, value2.AsString, StringComparison.InvariantCultureIgnoreCase)); } } return(value1 == value2); }