Tuesday, 21 June 2011

c# wishlist: quick check for empty strings

Any object can be null-coallesced using the fancy operator ??.
But alas!, empty strings are not null. Those pesky things keep getting in the way, particularly in order to avoid NullReferenceExceptions.

So, instead of str ?? "some default" or if(str != null) { }, like any other object... the code gets packed full of lengthy if(string.IsNullOrEmpty(str)) { }.

On a happy note though, I'm back to programming - YAY!