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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sandeep Singh ShekhawatPosted Jul 17, 2013, 8:35 AM
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();
}
}
}
VulpesPosted Jul 17, 2013, 8:32 AM