I have a datagrid populated by a Linq query. When the focused row in the datagrid changes I need to set a variable equal to one of the properties in that object.
I t
You could use the dynamic type to access properties of anonymous types at runtime without using reflection.
var aType = new { id = 1, name = "Hello World!" };
//...
//...
dynamic x = aType;
Console.WriteLine(x.name); // Produces: Hello World!
Read more about dynamic type here: http://msdn.microsoft.com/en-us/library/dd264736.aspx