2010/04/15

Exam Preparation C# Use ArrayList in ArrayList

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Collections;


 

namespace ConsoleApplication2

{


//Drow picture use ArrayList in ArrayList


class
Program

{


static
void Main(string[] args)

{


//Initialize parent arraylist


ArrayList al = new
ArrayList();


 


//Initialize child arraylist


ArrayList childal1 = new
ArrayList();

childal1.Add(" * ");


//Initialize child arraylist


ArrayList childal2 = new
ArrayList();

childal2.Add(" *** ");


//Initialize child arraylist


ArrayList childal3 = new
ArrayList();

childal3.Add(" ***** ");


//Initialize child arraylist


ArrayList childal4 = new
ArrayList();

childal4.Add("*******");


//Initialize child arraylist


ArrayList childal5 = new
ArrayList();

childal5.Add(" ***** ");


//Initialize child arraylist


ArrayList childal6 = new
ArrayList();

childal6.Add(" *** ");


//Initialize child arraylist


ArrayList childal7 = new
ArrayList();

childal7.Add(" * ");


 


//Put in child array into parent array

al.Add(childal1);

al.Add(childal2);

al.Add(childal3);

al.Add(childal4);

al.Add(childal5);

al.Add(childal6);

al.Add(childal7);


 


//Display ArrayList data


foreach (ArrayList array in al)

{


//Initialize IEnumerator


IEnumerator enm = array.GetEnumerator();


//Get data using IEnumerator


while (enm.MoveNext())

{


Console.WriteLine(enm.Current.ToString());

}

}

}

}

}

0 件のコメント:

コメントを投稿

UA-9417263-1