Video How to: Declare an Object by Using an Object Initializer

Object Initializer Video How To

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


Watch the video

Download the video and transcript

Read the step-by-step article

Video Summary

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.

Additional Video Resources

Video How Tos

MS Help WorkshopTOC Folder icon Visual Basic Videos

link to videoVideo How to: Writing Queries in Visual Basic

Other Videos

Additional Help Resources