DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

warf has posted 1 posts at DZone. View Full User Profile

Reverse String In C#

  • submit to reddit
        // description of your code here

public string Reverse2(string x)
    char[] charArray = new char[x.Length];
    int len = x.Length - 1;
    for (int i = 0; i <= len; i++)
        charArray[i] = x[len-i];
    return new string(charArray);