So, I just converted a bunch of code that used "" as an empty string like this:
if(myString == "") anotherString = "";
to
if(myString.Equals(String.Empty)) anotherString = String.Empty;
and I'm wondering if I did the right thing, using String.Empty. I hate having quoted strings in code and prefer to stay away from them whenever possible. This generally leads to code that is more strongly typed, and easier to maintain, so using String.Empty intuitively feels better than ““. But, I've actually found a concrete reason to use String.Empty - I did some research and found that in a test, str.Equals(String.Empty) is faster than comparing to ""! Well, okay. Research isn't the right word, “Doing one google search and accepting on faith the first post I saw” is slightly more accurate. I even created a little graph of the claims in this post here, that String.Empty is faster. I'm too lazy to do the test myself, so if you want to verify this, knock yourself out. I do love making graphs though.