/* attempt to deal with prototype, bootstrap, jquery conflicts */ /* for dropdown menus */

Jump to content

Image of the Day

What's the best way to move your heavy stuff? Using a power loader! #spacr #screenshotsaturday 💪🤖💪 https://t.co/sOjz2XNVeq
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

Setting members in VB.NET without constructors

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 Headkaze   Members   

607
Like
0Likes
Like

Posted 12 November 2013 - 01:58 PM

In C# I can do the following:

MyClass myObject = new MyClass() { Member1 = value1, Member2 = value2, Member3 = value3 };

Is there an equivalent in VB.NET?

#2 jms bc   Members   

448
Like
1Likes
Like

Posted 12 November 2013 - 03:50 PM

found this example

 

Public Class Customer

    Public Id As Integer

    Public Name As String

End Class

 

then, you can

 

Dim cust = New Customer() With {.Id = 2, .Name = "VB.NET 9.0"}


The Four Horsemen of Happiness have left.


#3 Headkaze   Members   

607
Like
0Likes
Like

Posted 13 November 2013 - 05:41 AM

That's great thanks. Never seen curly brackets used like that in VB.NET before. Is this feature only available to Visual Studio 9 (2008) and higher?




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.