creating objects from an array C# code example
Example: c# array of objects
T[] InitializeArray<T>(int length) where T : new() {
T[] array = new T[length];
for (int i = 0; i < length; ++i) {
array[i] = new T();
}
return array;
}
// Usage:
MyObjects[] my_objects = InitializeArray<MyObjects>(10);