ILearnable .Net

February 20, 2014

making C# compare two strings the same way SQL server will

Filed under: Uncategorized — andreakn @ 15:08

This snippet has served us well

public static bool LooksLike(this string value, string other)
  if (value == null)
    return other == null;
  return other != null &&
     value.Trim().Equals(other.Trim(), StringComparison.InvariantCultureIgnoreCase);

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

%d bloggers like this: