Used to Reverse a String - CSharp System

CSharp examples for System:String Reverse

Description

Used to Reverse a String

Demo Code


using System.Windows.Forms;
using System.Collections;
using System.IO;//from ww  w .j a v a  2 s . com
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;

public class Main{
        /// <summary>
        /// Used to Reverse a String
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public static string ReverseString(string s)
        {
            char[] arr = s.ToCharArray();
            Array.Reverse(arr);
            return new string(arr);
        }
}

Related Tutorials