There are many ways of checking if a string is empty, in C#:
string myString = ""; |
string myString = ""; |
string myString = ""; |
Performing benchmarks on these three methods resulted that the second method (myString.Length == 0) is almost three times faster than the other two.
The first (myString == “”) and third method (myString == String.Empty) perform equally.