Question: How to shorten this array creation ?
I need to create an array of type ReportingService2005_WebService.Property with one property.
Something like:
Dim PropertyArray() as new ReportingService2005_WebService.Property(1)
I have to do this:
Dim PropertyArray As ReportingService2005_WebService.Property() = New ReportingService2005_WebService.Property(0) {}
PropertyArray(0) = New ReportingService2005_WebService.Property
PropertyArray(0).Name = "Description"
PropertyArray(0).Value = "Automatically added DataSource"
http://blogs.msdn.com/b/wriju/archive/2008/02/05/vb-net-9-0-object-and-array-initializers.aspx
Make sure your “array brackets” are in the correct place in the initial Dim statement. Should be:
Dim PropertyArray()…