Hi all,
I am just wondering how you all check if a string is empty in C#.
I am a C/C++ programmer, and I usually check if the string is empty with the following code.
so naturally, I am checking if a string is empty with the following code in c#Code:if( strString.length() == 0 || strString.compare( "" ) == 0 ) // string is empty else // do something useful with the string
Is there a better way to check if a string is empty in C#?Code:if( strString.length == 0 || strString.CompareTo( "" ) == 0 ) // string is empty
Thank you,
kab




Reply With Quote