Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
You have tried to declare an instance of a class by using an object initializer in which the initialization list is empty, as shown in the following example.
' Not valid.
' Dim aStudent As New Student With {}
At least one field or property must be initialized in the initializer list, as shown in the following example.
Dim aStudent As New Student With {.year = "Senior"}
Error ID: BC30996
To correct this error
- Initialize at least one field or property in the initializer, or do not use an object initializer.
See Also
Tasks
How to: Declare an Object by Using an Object Initializer