C# / .NET - how to reverse a string

0 points
Created by:

In this article, we would like to show you how to reverse a string in C#.

Practical example

In the example below, we use the Array.Reverse() method, which argument is a string converted into an array of characters.

using System;

public class Program
    static string ReverseString(string originalString)
        char[] charArray = originalString.ToCharArray();
        return new string(charArray);

    public static void Main(string[] args)
        string originalString = "This is your text...";

        string reversedString = ReverseString(originalString);
        Console.WriteLine(reversedString); // ...txet ruoy si sihT


...txet ym si sihT
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

C# / .NET - String (popular problems)

C# / .NET - reverse string
Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂