String Isnullorempty() - C# Tutorial
C# Course / Strings / String Isnullorempty()

String Isnullorempty()

BLUF: Mastering String Isnullorempty() is essential for building robust applications with the .NET ecosystem. This tutorial provides clear explanations and practical examples to help you understand and apply this C# concept.
Enterprise Development Tip: String Isnullorempty()

C# is a powerful, modern language for enterprise solutions. Discover how String Isnullorempty() enhances your development workflow in the guide below.

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:

Logic Practice
Install Logic Practice
Add to home screen for a faster app-like experience