Console.WriteLine("Enter Names:");
string [] arr = new string []{horse,flag,apple,space,balloon};
how to sort names without using any sort methods?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Jul 17, 2013, 4:32 AM EDT
Sandeep Singh ShekhawatRank #147 · 15.6K reputationPosted Jul 17, 2013, 4:35 AM EDT
using System;
using System.Linq;
namespace SortingArray
{
class Program
{
static void Main(string[] args)
{
string[] arr = new string[] { "horse", "flag", "apple", "space", "balloon" };
var sortArray = from str in arr
orderby str
select str;
foreach (string item in sortArray)
{
Console.WriteLine(item);
}
Console.ReadKey();
}
}
}