C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C# String IsNullOrEmpty()The C# IsNullOrEmpty() method is used to check whether the specified string is null or an Empty string. It returns a boolean value either true or false. Signaturepublic static bool IsNullOrEmpty(String str) Parameterstr: it is a string parameter which is used to check string. ReturnIt returns boolean value. C# String IsNullOrEmpty() Method Exampleusing System; public class StringExample { public static void Main(string[] args) { string s1 = "Hello C#"; string s2 = ""; bool b1 = string.IsNullOrEmpty(s1); bool b2 = string.IsNullOrEmpty(s2); Console.WriteLine(b1); Console.WriteLine(b2); } } Output: False True
Next TopicC# String IsNullOrWhiteSpace()
|