using System;
using System.Collections;
//csc arraylist_CopyTo_sort.cs
namespace ex_arraylist
{
public class alist
{
ArrayList myS = new ArrayList();
public string sta1 = "";
public string sta2 = "";
public string sta3 = "";
public string sta4 = "";
public void procss()
{
Console.WriteLine("--Existing Players - " );
// Creates and initializes a new Queue.
//load players name to added
Console.WriteLine("--data - New Players added - " );
Console.Write("Player's Name 1: " );
sta1 = Console.ReadLine();
myS.Add(sta1);
Console.Write("Player's Name 2: " );
sta2 = Console.ReadLine();
myS.Add(sta2);
Console.Write("Player's Name 3: " );
sta3 = Console.ReadLine();
myS.Add(sta3);
Console.Write("Player's Name 4: " );
sta4 = Console.ReadLine();
myS.Add(sta4);
Console.WriteLine("All Counts :" + myS.Count);
//
int setlength = myS.Count + 10;
String[] myT =new String[setlength];
//Queue myT = new Queue();
myT[0]= "Baba" ;
myT[1]= "Lugo" ;
myT[2] = "Patrick" ;
myT[3] ="Jacob";
//display through read
read(myT, '\t');
/// added ques
// Creates and initializes a new Queue.
Console.WriteLine("----------");
myS.Sort();
myS.CopyTo(myT, 4 );
int final_length= myT.GetLength(myT.Rank-1);
Console.WriteLine("Copying or added to the list " + final_length);
//myS.AddRange(myT);
read(myT, '\t');
/// </summary>
/// <param name="em"></param>
//read(al);
} //end of method
public void read(IEnumerable em, char sep)
{
foreach ( Object obj in em )
Console.Write( "{0}{1}", obj,sep );
Console.WriteLine();
}
}
//end of arrylist class
class test
{
static void Main(string[] str)
{Console.Write("Enter a word a evry steps :");
alist at = new alist();
at.procss();
Console.ReadLine();
}//end of the class list
}
}//end of namespace