Using LINQ, I’m looking to place items which match a certain criteria at the top of my collection. I’ve tried
myCollection.OrderBy(m => m.Foo == "Bar" ? 0 : 1);
but I’m having no luck. Does anyone have any ideas why this isn’t working?
Thank you in advance.
OrderBy()and the other LINQ methods do not modify the collection they’re called on; instead, they return a new collection.