Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Reverse a string using Static class definition in C#

The class must be defined 'Static' before using this code.

Include:
  1. using System.Linq;


  1. using System;
  2. using System.Text;
  3. using System.Linq;
  4.  
  5.  
  6. namespace forgetCode
  7. {
  8. static class Program
  9. {
  10. public static void Main(string[] args)
  11. {
  12. Console.WriteLine("Enter the string to reverse :");
  13. string name = Console.ReadLine();
  14.  
  15. Console.WriteLine(name.Reverse());
  16.  
  17.  
  18. }
  19. public static string Reverse(this string input)
  20. {
  21. return new string(input.ToCharArray().Reverse().ToArray());
  22. }
  23. }
  24. }


Output:

Enter the string to reverse :
forget code

edoc tegrof