IsNullOrWhiteSpace

by Syska 22. April 2010 00:39

Instead of doing

   1: if(s == null || s.Length == 0)
   2:     return;

I normally do

   1: if(string.IsNullOrEmpty(s))
   2:     return;

So, as I would normally do, I started typing: string.Is and intellisense showed me an nice addition to the normal string class in .NET 4.0 … NICE :-).

   1: if (string.IsNullOrWhiteSpace(s))
   2:     return;

Its the little things in life that counts, this saved my evening after messing around trying to move all my projects from SVN to TFS 2010.

Tags:

Comments

Comments are closed

About the brain

Mikael SyskaMikael Syska

Student at the Engineering College of Aarhus.

Microsoft Student Partner ( MSP )

On this blog I will primarily write about .NET, MSSQL & projects I'm working on ... and of course there will some off topic posts :-)