.ToList() creates a new list object, adding to it all the elements of the input source, your array. Thus, the original array does not change at all.
You cannot add elements to an existing array, it has a fixed size, the only thing you can do is return the new array to a variable.
I have not tried, but I will try:
var l = v.ToList(); l.Add(...);
But note that at this point you should look at why you want to use anonymous types in the first place, I would seriously think about simply creating a named type and using a list to start with.
Note that you cannot write List l = v.ToList(); , since the type of the list is general (it will return multiple List<some-anonymous-type-here> , not just List ). With anonymous types, you need to use var .
source share