Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create an List of int arrays? [closed]

Tags:

syntax

c#

.net

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[]>;

like image 945
TreeNode Avatar asked Dec 14 '12 20:12

TreeNode


People also ask

How do you add an int array to an ArrayList in Java?

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.


1 Answers

You're missing parenthesis at the end of your new clause.

List<int[]> arrayList = new List<int[]>();

like image 67
Robert Davis Avatar answered Oct 13 '22 04:10

Robert Davis