C # sorting of arrays (forward and backward)
This sort is super simple!
Using system; using system. collections. generic; using system. LINQ; using system. text; namespace consoleapplication4 {class program {static void main (string [] ARGs) {string [] STR = {"D", "H", "A", "C ", "G", "T", "E", "U", "B"}; var lowtohigh = from P in STR orderby P select P; // LINQ STR = lowtohigh. toarray (); foreach (VAR item in Str) {console. writeline ("Forward order" + item ); // forward order} // ============================================== ==================== for (INT I = 0; I <Str. length/2; I ++) {string temp = STR [I]; // create a variable to exchange STR [I] = STR [Str. length-i-1]; STR [Str. length-I-1] = temp; // intercommunication} foreach (VAR newstr in Str) {console. writeline ("reverse order:" + newstr);} console. writeline ("====================================== "); //###################################### ######### int [] num = {5, 78, 9, 1, 8, 4, 2, 88, 3}; var lowtohigh1 = from P in num orderby P select P; num = lowtohigh1.toarray (); foreach (VAR num1 in num) {console. writeline (num1); // forward order} For (INT I = 0; I <num. length/2; I ++) {int temp = num [I]; // create a variable to exchange num [I] = num [num. length-I-1]; num [num. length-I-1] = temp; // intercommunication} foreach (VAR newnum in num) {console. writeline ("reverse order:" + newnum);} console. writeline ("====================================== ") ;}}}
Result: