dg (http://csharppad.com/gist/9755465)