📜  c# 对象数组 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:02.334000             🧑  作者: Mango

代码示例1
T[] InitializeArray(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(10);