You can initialize an anonymous object like this:
<!-- language: lang-vb -->Dim cust = New With {.Name = "Hugo", .Age = 23}
And you can initialize a collection like this:
<!-- language: lang-vb -->Dim numbers = {1, 2, 3, 4, 5}
Dim names As New List(Of String) From {"Christa", "Brian", "Tim"}
But can you initialize an array of anonymous object with syntax support
You can do it like this, but custs
will just be a plain object
:
You can do it like this, but each item in custs
will just be a plain object
:
How can I initialize a list/collection/array such that I can access the full power of the collection and also the properties of the anonymous object type inside