Friday, 1 December 2017

C# Program to Sort a List of Names in Alphabetical Order


Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main()
        {
            List names = new List();
            names.Add("Ram");
            names.Add("Rose");
            names.Add("Abs");
            names.Add("Edward");
            names.Add("Sita");
            names.Sort();
            foreach (string s in names) 
            Console.WriteLine(s);
            Console.ReadLine();
        }
    }
}


Output:

Abs
Edward
Ram
Rose
Sita


More C# Programs:



















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...