I want to convert IList to array: Please see my code:
IList list = new ArrayList(); list.Add(1); Array array = new Array[list.Count]; list.CopyTo(array, 0);
I'm surprised that
Array array = new Array[list.Count];
even compiles but it does not do what you want it to. Use
object[] array = new object[list.Count];
And, standard remark: if you can use C#3 or later, avoid ArrayList as much as possible. You'll probably be happier with a List
List