This article shares the implementation code of C# reversed writing method for your reference. The specific content is as follows
//string concatenation with for loop public string ReverseA(string text) { char[] cArray = (); string reverse = ; for (int i = - 1; i > -1; i--) { reverse += cArray[i]; } return reverse; } // function public string ReverseB(string text) { char[] charArray = (); (charArray); return new string(charArray); } // push/pop Stack<> public string ReverseC(string text) { Stack resultStack = new Stack(); foreach (char c in text) { (c); } StringBuilder sb = new StringBuilder(); while ( > 0) { (()); } return (); } // LINQ public string ReverseD(string text) { return new string(().Reverse().ToArray()); } // StringBuilder public string ReverseE(string text) { char[] cArray = (); StringBuilder reverse = new StringBuilder(); for (int i = - 1; i > -1; i--) { (cArray[i]); } return (); }
The above is all about this article, I hope it will be helpful for everyone to learn C# programming.