arraylist definition with example in C#.Net

Introduced in dotnet framework 1.1. This ArrayList class is implementing the IList interface, using this array size can increase dynamically.
Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace sortedlist
{
    class Program
    {
        static void Main(string[] args)
        {
            ArrayList objArrayList = new ArrayList();
            objArrayList.Add("Ranga");
            objArrayList.Add("Rajesh");
            objArrayList.Add("Kumar");

            SortedListKeysAndValues(objArrayList);
            Console.ReadLine();
        }

        public static void SortedListKeysAndValues(ArrayList arrayList)
        {
            for (int i = 0; i < arrayList.Count; i++)
            {
                Console.WriteLine(arrayList[i]);
            }
            Console.WriteLine();
        }
    }
}

 Output: 
Ranga
Rajesh
Kumar


Please give your valuable articals on this topic. We will post by the name of you, if you like. Please submit your articles in the comments.

Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar