ArrayList oldList = new ArrayList();
[...]
string[] newList = (string[]) oldList.ToArray(typeof(string));
2. From a List
List<
[...]
MyClass[] newList = oldList.ToArray();
DO NOT define a struct unless the type has all of the folloing characteristics:
- It logically represents a single value, similar to primitive types (int, double, etc.).
- It has an instance size under 16 bytes.
- It is immutable.
- It will not have to be boxed frequently.