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
The ASP.NET provides two namespaces. The first is System.WEB.mailmessage class and the second is System.Web.Mail.Smtpmail class.

Briefly explain how server form post-back works ?  Post Back: The process in which a Web page sends data back to the similar page on the server. View State : View State i


What is object-oriented programming (OOP)? OOP is a method to develop logical modules, such as classes that contain properties, methods, fields, and events. An object is formed

Develop a windows desktop application Project Description: I am looking to get a desktop application developed. The desktop application will have the subsequent few features:

What is UML? The Unified Modeling Language (UML) is a graphical language for documenting, specifying, visualizing,  constructing, and  the artifacts of a software-intensive sys

How will you implement Page Fragment Caching? The Page fragment caching includes the caching of a fragment of the page, rather than the whole page. When the parts of the page a

We would like you to develop the subsequent requirements in one plug-in already in production. The plug-in was developed in Visual Studio 2010 .NET Framework 4 C# and synchronizes

What is Unicode? In order to understand the concept of Unicode we require  to move a little back and understand the ANSI code. The ASCII (ask key) stands for American Standard

How to clear a datagrid on a button click? You require to Clear the DataSource of the dadaGrid. So try this: dataSet1.Clear(); dataGrid1.DataSource = dataSet1.TableNam