In Looping cann't remove and insert ArrayList?
I am a C# beginner.I've some problem with this exercise.Can you give me some advise?Because I've no ide what should i do.
ArrayList arrayList = new ArrayList();
Console.Write("Enter code:");
arrayList.Add(Console.ReadLine());
Console.Write("Enter qty:");
arrayList.Add(Convert.ToInt32(Console.ReadLine()));
Console.Write("Enter code:");
arrayList.Add(Console.ReadLine());
Console.Write("Enter qty:");
arrayList.Add(Convert.ToInt32(Console.ReadLine()));
ArrayList looplist = new ArrayList(arrayList);
foreach (object text in looplist)
{
if (Convert.ToString(text) == "p")
{
arrayList.RemoveAt(0);
arrayList.Insert(0, "Programming");
}
else
{
arrayList.RemoveAt(2);
arrayList.Insert(2, "Graphic");
}
Console.WriteLine("{0}", text);
}