开发者

Does VB.NET 2010 support arrays of anonymous objects?

开发者 https://www.devze.com 2023-01-18 03:44 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消