New keyword VB.Net 2008

I could have sworn I saw a new demo of new features in VS 2008 that included a way to set public variables without creating a lot of constructors that take variables and set them to values. Does anyone know the syntax for this?

0


source to share


1 answer


You might be talking about Object Initializers like ... this is a feature of C # 3.0 and VB.NET 9.

Dim cust = New Person() With {.Id = 2, .Name = "Jesse B"}

      



and in C #

var cust = new Person() { Id = 2, Name = "Jesse B"};

      

+4


source







All Articles