- Home /
How can I order an array of RaycastHits in reverse order of distance?
I have 2 Raycasthit arrays and one is being arranged in distance using System.Linq and OrderBy(h=>h.distance).ToArray() is there a way of flipping this around so that it is the other way? Something like OrderBy(h=>h.-distance).ToArray()? Thanks
Comment
Best Answer
Answer by incendy · Aug 28, 2013 at 10:04 PM
In linq you would use OrderByDescending() instead of OrderBy.
Haha, I had trouble finding it the first time too. Wasn't expecting it to be named so logically :D