Contents tagged with extension methods

  • JsonResult Extension Method

    Mildly silly and maybe making too many assumptions though it is, I worked up a little extension method to generically evaluate (and return) the Data property of a JsonResult class. Makes life a little easier when testing JsonResult action methods on controller instances.

  • Dictionary Extension Method - Append

    I've been creating a few extension methods here and there recently and figured I'd share one of the ones I'm using in a lot of places. This one is an extension method named Append that you can use with a generic IDictionary implementor to do quick-and-dirty creations of the object. I've found this to be really useful when I'm writing tests that use the generic IDictionary class in my tests. The first block of code below will point out the extension method.