21 August 2012

Reverse string using C#.Net

Here i will give method for displaying reverse of string value using C#.net
ReverseValue is a method for display reverse of string.

public static string ReverseString(string str)
{
int length =str.Length -1;
while (length >-1)
{
stringresult = stringresult + str[length];
length--;
}
return stringresult;
}
Call method : 
  string str = DerivedClass.ReverseString("LAKSHMI");
    MessageBox.Show(str.ToString());

No comments: