Answers for "c# array of lists"

C#
3

c# arraylist

ArrayList arr = new ArrayList();

arr.Add(item) //Adds item at end of ArrayList
arr.Count //get lenght of ArrayList
arr.Remove(int i) //Remove Item from Index
arr[x] //Get Item at pos x
Posted by: Guest on December-02-2021
2

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
0

how to list elements of an array C#

int[] numarray = {1, 2, 3 ,4};
foreach(int num in numarray){
  /* You can do a lot of things with the elements, 
  I am going to just print them to the console. */
  System.Console.WriteLine(num);
}
Posted by: Guest on December-31-2021

C# Answers by Framework

Browse Popular Code Answers by Language