How to reverse string without using Reverse() in C# - Programming for Beginners
Reverse string without using any C# function
Recently in one of the interviews I was asked to reverse the string without using Reverse() in .Net. Below is the simple code to demonstrate how to reverse the string with a simple for each loop.
string strValue = "Interview question for beginner!";
string reverseValue = string.Empty;
foreach (char c in strValue)
reverseValue = c + reverseValue; // concantenate the characters in a reverse mode
How to reverse string without using Reverse() in C# - Programming for Beginners Reviewed by Ravi Kumar on 9:23:00 PM Rating: