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