Code for Sorting Algorithm in C#