This example for you to share the C # string in reverse order of the implementation code, for your reference, the specific contents are as follows
string concatenation with For loop public string Reversea (string text) {char[] CArray = text.
ToCharArray ();
string reverse = String.Empty;
for (int i = carray.length-1 i >-1; i--) {reverse + = Carray[i];
return reverse; }//Array.reverse function public string Reverseb (string text) {char[] Chararray = text.
ToCharArray ();
Array.reverse (Chararray);
return new string (Chararray);
}//Push/pop stack<> public string reversec (string text) {Stack resultstack = new Stack ();
foreach (char c in text) {Resultstack.push (c);
StringBuilder sb = new StringBuilder (); while (Resultstack.count > 0) {sb.
Append (Resultstack.pop ()); Return SB.
ToString (); //LINQ public string reversed (string text) {return new string (text). ToCharArray (). Reverse ().
ToArray ()); }//StringBuilder public string Reversee (string text) {char[] CArray = text.
ToCharArray ();
StringBuilder reverse = new StringBuilder (); for (int i = Carray.leNgth-1; i >-1; i--) {reverse.
Append (Carray[i]); return reverse.
ToString ();
}
The above is the entire content of this article, I hope that you learn the C # program to help.