How to sort an array in C# ?

If you want to sort an array in C#.NET , you can use the Array.Sort method to do it.

How to sort an array in C# ?

Below is a sample code snippet demonstrating the usage of the Array.Sort method to sort an array in C#.

using System;
using System.Collections.Generic;
using System.Linq;

namespace AbundantCodeConsoleApp
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            string[] inputStr = { "Java", "CSharp", "Xamarin", "Windows", "android", "iOS" };
            Array.Sort(inputStr);
            foreach (var item in inputStr)
                Console.WriteLine(item);
            Console.ReadLine();
        }
    }
}
image