
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Reverse a String Using Chash
To reverse a string, use the Array.Reverse() method.
Set the string you want to reverse −
string str = "Amit";
In the above method, we have converted the string into character array −
char[] ch = str.ToCharArray();
Then the Reverse() method is used.
Array.Reverse(ch);
Example
using System; namespace Demo { class Program { static void Main(string[] args) { string str = "Amit"; char[] ch = str.ToCharArray(); Array.Reverse(ch); foreach(var items in ch) { Console.WriteLine(items); } Console.ReadLine(); } } }
Advertisements