Algorithms for sorting data writhen in CSharp