In your samples, solution 2 is the fastest. But this solution is different from others because it does not check if the string is empty.
Otherwise, given that you want to check if the string is empty or empty, solution 5 is the fastest. String.IsNullOrEmpty () does the same as solution 5, but adds a function call (if it is not inline at run time). However, I would recommend the first solution:
1 / performance penalty is negligible
2 / Easier to read
3 / it is a built-in method, therefore it is reliable
source share