Anonymous Types

There are 2 entries for the tag Anonymous Types

What isn’t RIGHT with var

Let me start by saying I have no qualms against using var to declare variables. I use it myself when it suits me. I find the best situations to take advantage of it are: When using anonymous types When declaring variables which are instances of an interface The first case is really not optional. You can’t declare an anonymous type without var. The second, should be used carefully because it can impede readability if used incorrectly. Since you cannot initialize an interface the right side of your declaration might...

Extend Anonymous Types using Reflection.Emit

I've been playing with the new ASP.NET MVC Framework CTP which uses anonymous types to build url paths which allow you to change the path format. I'm really enjoying the control and the separation of concerns you get.As I've been writing my MVC application I needed to maintain a parameter in all urls for authenticated users but I didn't want to have to manually include the paramter in every url, form action and redirect. So I wrote some extension functions which wrap the Html and Url helper class methods used to build urls (ActionLink, Form and Url). Additionally, I wrote...

 

 

Copyright © Mark J. Miller