Submitted by alastairs on 15 September 2011 - 6:09pm
Here's a handy trick I discovered whilst fixing a bug. You can initialise a collection from another collection and add new items to it as follows:
Note that the collection initialiser on AllFoo runs before the constructor, so the Foo created with constructor parameter 4 will appear first in AllFoo, followed by everything in BaseCollectionOfFoo in the expected order.
Submitted by alastairs on 17 August 2011 - 9:01pm
I was struggling to find a way to pretty-print a JSON string in .NET. I already have the excellent Json.NET package available and after a bit of hunting, I came up with this:
It wasn't obvious how to do this, for some reason - I spent a while investigating the JsonReader and JsonWriter classes to no avail.
Hope this helps you too!
Submitted by alastairs on 5 August 2011 - 11:58pm
I spent some of this evening watching the video from Microsoft Research on their Project Roslyn, the codename for the Compiler-as-a-Service functionality they're developing for .NET vFuture.
The most interesting parts of the talk for me were: