Answers for "class array c#"

C#
7

c# array

float[] array = new float[] { 1f, 5f, 4f, 3f };
Posted by: Guest on June-08-2020
1

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);
Posted by: Guest on March-19-2021

C# Answers by Framework

Browse Popular Code Answers by Language