Most advisable way of checking empty strings in C#
问题 What is the best way for checking empty strings (I'm not asking about initializing!) in C# when considering code performance ?(see code below) string a; // some code here....... if(a == string.Empty) or if(string.IsNullOrEmpty(a)) or if(a == "") any help would be appreciated. :) 回答1: Do not compare strings to String.Empty or "" to check for empty strings. Instead, compare by using String.Length == 0 The difference between string.Empty and "" is very small. String.Empty will not create any