How to sort an array in C# ?


This content was proof-read by Grammarly. You can Try Grammary for FREE

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#.


Are you a .NET Developer planning to integrate GraphQL for .NET in your Application? Check out this book BUY & DOWNLOAD GRAPHQL.NET COOKBOOK
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
%d bloggers like this: