(http://csharppad.com/gist/9950716)