Retrieving values from an array list in C# ?
Reply
|
|
From:
Kalyan Ganjam
|
Hi Pavan, I donno what difficult you have in understanding kapils reply. I am adding code snippet whic adds and retrieves values from an arraylist and prints in console after retireving from arraylist. //Instantiate arraylist and Add Items ArrayList myArrayList = new ArrayList(); myArrayList.Add("this"); myArrayList.Add("is"); myArrayList.Add("a"); myArrayList.Add("Reply"); myArrayList.Add("to"); myArrayList.Add("Pavan Jayavarapu"); myArrayList.Add("from"); myArrayList.Add("Kalyan Ganjam"); myArrayList.Add("u"); myArrayList.Add("can"); myArrayList.Add("also"); myArrayList.Add("add"); myArrayList.Add("numbers"); myArrayList.Add("like"); myArrayList.Add("this"); myArrayList.Add("My Age is"); myArrayList.Add(23); //Retrieve all values from arraylist using good old for loop for(int i = 0; i < myArrayList.Count;i++){ Console.Write(myArrayList[i].ToString()+" - "); } this is what i see in my console window after the above code snippet executes this - is - a - Reply - to - Pavan Jayavarapu - from - Kalyan Ganjam - u - can - also - add - numbers - like - this - My Age is - 23 - |
|
View other groups in this category.
|
To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.
Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.
If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.
|
|
- Re: Retrieving values from an array list in C# ? Kalyan Ganjam
-