c# - Orderby in generic list -
I have a generic list that I am composed of two other lists. The order is not working properly. BeOrders come first (order according to date) then BTOrders (order according to date). Did I clarify something? I can not see anything wrong
order = new list & lt; DataLayer.OrderStatusItem & gt; (); Orders.AddRange (BeOrders); Orders.AddRange (BTOrders); Orders.OrderBy (z = & gt; z.ordered);
Yes, you remembered that OrderBy doesn 'T command in-place - this returns is an order sequence: var inOrder = orders.OrderBy (z = & gt; z .ordered); Or (assuming that order type is the list & lt; ... & gt; : < Pre> order = order.orderbie (z = & gt; z.ordered) .Oolist (); Note that "no side effects" approach is not prevalent in the entire LIKQ Any operator can not change the archive which they say, they return a view on that collection (filtered, projected etc.) of some form.
If you list the list & lt; T & Gt; which you want to sort You can use the place. (You must specify the sequence in different ways.)
Comments
Post a Comment