I want to create a list and each element of it is an array, similarly to an array of structs in C language. Can it be done in c# and how if it can? Thanks very much!
Wrong: List<int[]> arrayList = new List<int[]>;
An array can be converted to an ArrayList using the following methods: Using ArrayList. add() method to manually add the array elements in the ArrayList: This method involves creating a new ArrayList and adding all of the elements of the given array to the newly created ArrayList using add() method.
You're missing parenthesis at the end of your new clause.
List<int[]> arrayList = new List<int[]>();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With