Answer: 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;
if(string.IsNullOrEmpty(str))
MessageBox.Show('value is null');
else
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