Most performant way of checking empty strings in C# [closed]

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 object while "" will create a new object in the memory for the checking. Hence string.empty is better in memory management.
But the comparison with string.Length == 0 will be even faster and the better way to check for the empty string.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)