anonymous types - c#, what does method ( new { x=y.property } ) mean? -
i've been watching videos on asp.net mvc, think question general c# 1 though. i notice in example code, method paramters called this blah.method("something here", "something else", new { blah=item.someproperty }); can explain happening 3rd parameter? see video watching, method takes in object third paramter. it anonymous type, property called blah , given value evaluating item.someproperty . in cases interesting way of passing set of key/value pairs - easier dictionary, example: new {forename="fred", surname="jones" } is simpler same dictionary , 2 records ("forename"/"fred", "surname"/"jones"). mvc uses approach in number of places pass in semi-optional parameters (a bit convention on configuration). quite comparable lot of jquery, , let's face it: mvc users using jquery, 2 approaches site quite nicely together. i discuss topic (along string.format ...