65.9K
CodeProject is changing. Read more.
Home

Reverse of a string without using the Reverse function in C# and VB

starIconstarIconstarIconstarIconstarIcon

5.00/5 (3 votes)

Jul 23, 2011

CPOL
viewsIcon

10463

I wouldn't create a class for this. I'd make it an extension method, and then do this:public static class String Extensions{ public static string Reverse(this string value) { value = // do your reverse code here; return value; }}// Usage:string x...

I wouldn't create a class for this. I'd make it an extension method, and then do this:
public static class String Extensions
{
    public static string Reverse(this string value)
    {
        value = // do your reverse code here;
        return value;
    }
}

// Usage:

string x = "reverse";
x = x.Reverse();