Friday, May 13, 2011

Reverse a String in C#

private void gridView1_CustomUnboundColumnData(object sender,
                      DevExpress.XtraGrid.Views.Base.
CustomColumnDataEventArgs e)
{
GridView view = sender as GridView;
if (e.Column.FieldName == "Reversed" && e.IsGetData)
{

char [] charArray=((InDirectContacts)view.GetRow(e.RowHandle)).Name.ToCharArray();
Array.Reverse(charArray);
string reversedContactName = new string(charArray);
e.Value = reversedContactName;
}
}

No comments :

Post a Comment