I would like to populate the arraylist by specifying a list of values just like I would an integer array, but I'm not sure how to do this without calling the add method again.
For example, I want to assign {1, 2, 3, "string1", "string2"} to arraylist. I know that for other arrays you can do the job as follows:
int[] IntArray = {1,2,3};
Is there a similar way to do this for an arraylist? I tried the addrange method, but the curly brace method does not implement the ICollection interface.
source
share