zq5-1g
Last Updated: February 25, 2016
·
647
· tylerfowler
878a87ce30eec604f62b772289b9692e

Checking if a String is Null or Empty in .NET (C#)

Nifty little method built into the .NET String class that is cleaner than checking for both conditions.

if (String.IsNullOrEmpty(stringVal))
    /* do stuff */
Say Thanks
Respond

1 Response
Add your response

11816
0 z4fpdfzoj47psvnwzpt d5lwxzekf9zwbj1 dk z8uy8rtgimocr xqnlro7uaqbqrlggi8g4b93

I have used the string.IsNullOrWhiteSpace() method. It is a little bit more aggressive and checks if the string contains white-space characters.

over 1 year ago ·