June 22, 2005

C# tip of the night


IList list = new ArrayList();
list.Add("the only item in my list");

for(int i = 0; i < list.Count; i++)
{
Console.WriteLine(list[i].ToString()); //using the variable 'i' is goodness
Console.WriteLine(list[1].ToString()); //erroneously using the number 1 instead of 'i' is not goodness
}