I am sorting a GridView bind to a ananymous type.
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) { List<object> lb = (List<object>)ReturnAnony(); // Not working // ?? What to write here } object ReturnAnony() { var anony = // I create the ananymous type and return return anony; }
Not really sure what you want.
If you are going to create a List that is typed to anonymous type, you can use a currying function to help you:
Is that what you want?
Otherwise, you cannot reference the anonymous type outside of its scope unless you create a path to bridge the type information over to your code… which… in the end you should just made a new class.