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 new feature supports are shown below :- Better Language Support 1) The New ADO.NET Concepts have been implemented. 2) The ASP.NET supports complete  language

What are LeaseTime, Sponsorship Time, Renew on Call Time and Lease Manager Poll Time? In the normal .NET environment objects lifetime is managed by garbage collector. But inrem

What is shadowing? When 2 elements in a program have similar name, one of them can hide and shadow the one. Therefore in such cases the element which shadowed the main element

Project Description: I am seeking some automated trading software for the given strategy, I am using Omnesys Nest trader Step 1: Buy one share at current market price (ex:

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

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

What are the ways of parsing XML document? The XML parser sits in between the XML document and the application who want to use the XML document. The Parser exposes a set of wel

What are Windows services? Windows services, previously called as NT services, are applications that are installed on the system as system services. In other words, Windows ser

This is a whole time contractual role working for a sports advisory service. We are data insights consultancy specializing in sports. We consult to a number of sporting organizatio

What are the main components of .NET Framework? .NET Framework gives enormous benefits to software developers in comparison to the advantages given by other platforms. Microsof