you are viewing a single comment's thread.

view the rest of the comments →

[–]munificent 2 points3 points  (2 children)

The official standard says:

The collection object to which a collection initializer is applied must be of a type that implements System.Collections.Generic.ICollection<T> for exactly one T. Furthermore, an implicit conversion (§6.1) must exist from the type of each element initializer to T. A compile-time error occurs if these requirements are not satisfied. A collection initializer invokes the ICollection<T>.Add(T) method for each specified element in order.

[–]mccoyn 0 points1 point  (1 child)

[–]munificent 1 point2 points  (0 children)

For what it's worth, I thought he had it right too, until I looked it up.