How to check if string is null or empty

To check if string is null or empty we use IsNullOrEmpty method.This method returns Boolean value. If string is null or is empty it will return true otherwise false.

string Name = "";
if (string.IsNullOrEmpty(Name))
{
    Console.WriteLine("Name is null or empty");

}

Output

Name is null or empty

Comments

Popular posts from this blog

Using Progress Bar In C#

Get elements by class name in javascript

Jquery serer side datatables in asp.net