2009/08/07

C# Is null or string is empty

I just found that there is a "new" thing to check the string is null or empty (asp.net 2.0)

old way:
if (var == string.Empty && var == null)

new way:
if (String.IsNullOrEmpty(var))

It looks cool right? Enjoy!

No comments:

Post a Comment