Tuesday, 9 December 2008

C#: The best way to reverse a string

3 lines simple code here:
string ReverseString (string text)
{
    char[] _ch = text.ToCharArray();
    Array.Reverse(_ch);
    return new string(_ch);
}

No comments: