first we need an Extension class:
Code:
static class Extension
{
static public T CastTo<T>(this object o, T t)
{
return (T)o;
}
}
Code:
var v = al[0];
Console.WriteLine(v.CastTo(new { field1=String.Empty}).field1);
Leave a comment: