Video How to: Declare an Object by Using an Object Initializer
Authors: Kathleen McGrath, Harry Miller, Sahnny Johnson, Mick Alberts, Microsoft Corporation
Applies to: Microsoft Visual Basic 2008
Length: 00:03:37 | Size: 26.3 MB | Type: WMV file
Object initializers enable you to declare and instantiate an instance of a class in a single statement. You can also initialize one or more members of the instance at the same time, without invoking a parameterized constructor.
This video shows you how to create an instance of a Student class by using an object initializer in three different ways. The following tasks are included in the process:
How to create an object of a named class by using an object initializer.
How to declare a new instance of the class and then assign a value to it.
How to declare a new instance using local type inference.
The Visual Basic Help includes the code and the steps that are demonstrated in this video. See How to: Declare an Object by Using an Object Initializer.