Wednesday, November 28, 2018

Collection constructor with collection initialzer

You can pass anything that is a valid constructor parameter. For example, List permits construction from any enumerable, so you can do this:

this combination notation is useful if you want to clone an existing collection and then make some tweaks to it.

No comments :