This documentation is archived and is not being maintained.

Object initializer syntax cannot be used to initialize an instance of type 'Object'

Visual Studio 2008

You cannot initialize an instance of Object by using object initializer syntax. An instance of Object has no properties or fields to assign a value to, and object initializer syntax requires at least one such property or field.

' Not valid.
' Dim obj1 = New Object With {}
' Dim obj2 = New Object With {.ToString = <some value>}

Error ID: BC30994

To correct this error

  • Declare instances of type Object without using an initializer list:

    Dim obj3 as Object
    Dim obj4 as New Object()