Wednesday, March 24, 2010

Goodbye trim()

I’ve been playing a bit the the RC version of the .net framework 4 and already found a new cool method.

Until now when I wanted to check for a valid string I had to use the following code:

if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(text.Trim()))
    throw newArgumentNullException("text", "text is not valid");

And I had to do that because a string containing nothing but white spaces was not valid and if you called the Trim() method on a null string you’ll get a NullReferenceException, you know the message… (“Object reference not set to an instance of an object.”)

So, the new cool method I found is a static method from string called IsNullOrWhiteSpace. the name pretty much says it all, except that the real name should be IsNullOrEmptyOrWhiteSpaces ;)

Instead of writing the code shown above, where you could easily forget the second condition, now you can have the same behavior in one single sentence:

if (string.IsNullOrWhiteSpace(text))
    throw newArgumentNullException("text", "text is not valid");

Read Full Post

Tuesday, March 09, 2010

New features to the Azure Web Storage Explorer

On the first version you could only manage blobs, upload, delete and download them. Now I added the same functionality for Queues and Tables.
I found a pretty cool way of showing unstructured data from the Azure tables from a gridview control. How? with my good old friends the DataSets :)
I also updated the source code so you can download the source files from the version that it’s right now running on the Azure platform.
Go to to see the application running and here to download the source code.
Feedback is always welcome!

Edit: url is now

Read Full Post