What is an alternate way of checking whether string is Empty or not?

 Posted by Rajesh_Kumar on 1/20/2014 | Category: C# Interview questions | Views: 673 | Points: 40
Answer:

We can check whether string is Empty or not with the help of String'Length property .
For Example:-

string name = "Rajesh Kumar Sathua";

if (name.Length > 0)
{
MessageBox.Show("string has a value");
}
else
{
MessageBox.Show("string is empty");
}


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response