Read an array and perform sorting - c# program, DOT NET Programming

Read an Array and perform Sorting - C# program

Can any one assist me in performing sorting of an array.

Posted Date: 2/12/2013 1:37:21 AM | Location : United States





 

using System;

using System.Collections; // We need to implement collection class  

class ArrayList

{

  public static void Main(string []args)

 {

  ArrayList n = new ArrayList ();  

   // Read all the array items from the console

  n.Add(args[0]);

  n.Add(args[1]);

  n.Add(args[2]);

  n.Add(args[3]);

  n.Add(args[4]);  

  Console.WriteLine ("The items in the Array List before sorting are : ");  

   for (int i =0; i< n.Count; i++)

  {

   Console.Write (i + " : " +n[i]); // Print each array element

  }  

  n.Sort(); // Sort the array list

 

  Console.WriteLine ("The items in the Array List after sorting are : ");  

   for (int i =0; i< n.Count; i++)

  {

   Console.Write (i + " : " +n[i]); // Print each array element

  }

  Console.ReadLine();

 }

}

 

Posted by isbell | Posted Date: 2/12/2013 1:37:50 AM


Related Discussions:- Read an array and perform sorting - c# program, Assignment Help, Ask Question on Read an array and perform sorting - c# program, Get Answer, Expert's Help, Read an array and perform sorting - c# program Discussions

Write discussion on Read an array and perform sorting - c# program
Your posts are moderated
Related Questions
What does Xml Validating Reader class do? The XmlTextReader class does not validate the contents of an XML source against a schema. The correctness of the XML documents can be

Design the following interface and add code to the command buttons to achieve the following using case statement. I) find coursework to be calculated using the following formula:-0

What is cloud computing? The cloud computing is the computing which is completely based on the Internet. It can also be explained as the next stage in the evolution of the Inte

What is DBCC? The Database Consistency Checker Commands (DBCC) is used to check the logical and physical consistency of the database structure.The DBCC statements can fix and d

What is the difference between "DataSet" and "DataReader"? The major differences between "DataSet" and "DataReader" are as follows:- 1)The "DataSet" is a disconnected archit

What is the difference between "DataSet" and "DataReader"? The major differences between "DataSet" and "DataReader" are as follows:- 1)The "DataSet" is a disconnected archit

Project Description: We are seeking a simple tool that can convert an existing flash file (.SWF) into HTML5. Our idea is to convert small flash games into html5 games. Please NO

State the differences between the Dispose () and Finalize(). CLR uses the Dispose and Finalize methods to perform garbage collection of run-time objects of .NET applications.

Project Description: The website should be CMS based; coding done only on ASP, MySql databases, .net script, aspx and java use with least of the flash work. We will be sharing j

What are the authentication methods in .NET? 1.Windows authentication 2.Forms authentication 3.Passport authentication 4.None/custom authentication