Sorting


Sort Method

A corrolary to this is the SharedSort method. The only catch here is that whatever objects you sort must implement the IComparable Interface. After all, it's easy to sort Integers, but how could the framework possibly know how to sort Foo objects if Foo doesn't have a mechanism to tell you what is greater than or less than what?

System.Array.Sort(MyIntArray); 


Reverse Method

Similar to sort is the Shared Reverse method. The requirements are the same, your objects need to implement IComparable for the same reasons that apply to sort.

System.Array.Reverse(MyIntArray); 





© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext