String Isnullorempty()

The C# IsNullOrEmpty function is employed to verify if the provided string is either null or an empty string. It delivers a boolean outcome of either true or false.

Signature

Example

public static bool IsNullOrEmpty(String str)

Parameter

The str parameter is utilized to verify a string.

Return

It returns boolean value.

C# String IsNullOrEmpty Method Example

Example

using 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:

Output

False
True

Input Required

This code uses input(). Please provide values below: