You are viewing a single comment's thread. Return to all comments →
Array.Sort has many overloads.
This is the one I am using Array.Sort(Array, Comparison)
I'm passing a Delegate as my second parameter in this method.
Delegates are like function pointers in C++.
Comparison is a delegate similar in essence to IComparer.
An easier way to view it is Comparison is an function "reference." I just pass the function and avoid implementing the interface for IComparer.
Comparison, similar to IComparer returns an int. Zero is equal to match. Positive is greater than. Negative is less than.
If you are new to C# and know Java 8: In Java 8 has lambda expressions.
If you are new to C# and know Java 7 and before: It's similar to implementing an anonomous class.
That's an overview of what is happening with the Array.Sort
Seems like cookies are disabled on this browser, please enable them to open this website
Big Sorting
You are viewing a single comment's thread. Return to all comments →
Array.Sort has many overloads.
This is the one I am using Array.Sort(Array, Comparison)
I'm passing a Delegate as my second parameter in this method.
Delegates are like function pointers in C++.
Comparison is a delegate similar in essence to IComparer.
An easier way to view it is Comparison is an function "reference." I just pass the function and avoid implementing the interface for IComparer.
Comparison, similar to IComparer returns an int. Zero is equal to match. Positive is greater than. Negative is less than.
If you are new to C# and know Java 8: In Java 8 has lambda expressions.
If you are new to C# and know Java 7 and before: It's similar to implementing an anonomous class.
That's an overview of what is happening with the Array.Sort