How to check whether string has been assigned a value or not?

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

With the help of IsNullOrEmpty method of string,we can check whether string has a value or not.It returns True or False.
Basically IsNullOrEmpty checks whether string contains value or not.

For Example:-

string str = null;

MessageBox.Show('value is null');
MessageBox.Show('value is not null');

Output would be 'value is null' because str varaible has not assigned any value.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response