Does VB.NET 2010 support arrays of anonymous objects?
In C#, one can create an array of anonymous objects with new []
. This was not supported in earlier versions of VB.NET, but a comment by Chris Dwyer in another StackOverflow post suggests to me that it might be supported in VB.NET 2010. I haven't been able to confirm this though.
Does VB.NET 2010 support arrays开发者_Python百科 of anonymous objects?
Yes it does. You can write one like this:
Dim values = {New With {.First = "Matt"}, New With {.First = "Mallory"}}
Updated: I removed the not needed () after values as pointed out by Ahmad Mageed
精彩评论