List <String> Sortedheight =NewList <String>();Foreach(VaRCSInOptional Doc. selectnodes ("XML/sorted set") {Xmlelement tempele= CsAsXmlelement; sortedheight. Add (tempele. attributes ["Height"]. Value);} sortedheight. Sort (heightcomapare );
The sort parameter type is the method that returns the int value.
Private Static IntHeightcomapare (StringX,StringY ){Return(Int. Parse (x )-Int. Parse (y ));}
Input value: "0" "180" "30" "90"
Returned value: "0" "30" "90" "180"
---------------------------------
Ii. Sort datatable by dataview
// Sort DT by buildingname. columns. add ("namelength"); For (INT I = 0; I <= DT. rows. count-1; I ++) {DT. rows [I] ["namelength"] = DT. rows [I] ["buildingname"]. tostring (). length;} dataview tempdv = DT. defaultview; tempdv. sort = "namelength ASC"; // change the order of dataview dt = tempdv. totable (); // generate a able from DV