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
Define the ToolTip control. How can you associate it with other controls? The ToolTip control produces a small pop-up window with explanatory text for an element it is displaye

What are the problems that can occur if you do not implement locking properly in SQL SERVER? The problems that occur if you do not implement locking properly in SQL SERVER is a

I want to develop a Windows 8.1 Application Project Description: Media Player App Development for Windows 8.1 platform with brilliant UI, flexible controls and easy to use.

A Super-hero SharePoint developer with great design skills Project Description: US: Our start-up company prepares a very innovative and cool SharePoint related product with c

What is a LinqDataSource control? The LinqDataSource control enables you to use LINQ. In an ASP.NET Web page by setting the properties in the markup text. You can use the contr

Explain the fundamental of connection pooling. Whenever a connection is opened first time a connection pool is created and is based on the exact match of the connection string

Program for Declaration and Additions of Variables, I am a learner of C# language and i am struggling with the declaration of variables in C#. Can you have any code examples for th

Update current website backend (asp.NET) and build Rest API to expose data I will shortly shape an HTML5 cross-platform mobile app. I at present have a website with a backend th

What is Cache Callback? The Cache object is dependent on its dependencies for example time based, file based, etc...The Cache items remove the object when cache dependencies ch

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