I have a complex object:
+ Client
+ Products
+ Types
| TypeId
| ManagerCode
| TypeName
....
A single client will be associated with a collection of products they have bought, and each product will have a collection of types associated with it.
I need to sort the ‘Types’ on two properties – ManagerCode and TypeName.
eg: client.Products.ForEach(o => o.Types.OrderBy(o1 => o1.BaseType.ManagerCode));
Well, when I do this, the list doesn’t actually order once returned to the front end. It maintains the original sort order. What am I doing wrong?
OrderBydoesn’t replace the original collection; it returns a newly-sorted collection.Assuming
Typesis a list, you need