c# - How to order a IEnumerable<T> of anonymous type? -
Look at the code below, I do not know why my order is not working, any thoughts?
var command sample = new {ProductName = "", quantity = 0, UserFullName = ""}; Var order list = (new [] {orderSample}). ToList (); // Order to order a time to loop through another collection and place order. Add list (new {ProductName = "Product1", volume = 5, UserFullName = "Mr. Smith"}); // To order the order according to the names - The order does not work. Orderbie (P => P. productname); GvReport3.DataSource = ordersList; GvReport3.DataBind ();
var sortedList = ordersList.OrderBy (p = & gt; p. ProductName) .to create the list ();
Comments
Post a Comment