Reverse a String - CSharp System

CSharp examples for System:String Reverse

Description

Reverse a String

Demo Code


using System.Text;
using System;/*from  www.j av a  2  s.com*/

public class Main{
        public static string Reverse(string s)
        {
            if (s == null)
                throw new ArgumentException("s is null");

            var charArray = s.ToCharArray();
            Array.Reverse(charArray);
            return new string(charArray);
        }
}

Related Tutorials