开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜