Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

FormatterServices.GetUninitializedObject Method

Creates a new instance of the specified object type.

[Visual Basic]
Public Shared Function GetUninitializedObject( _
   ByVal type As Type _
) As Object
[C#]
public static object GetUninitializedObject(
 Type type
);
[C++]
public: static Object* GetUninitializedObject(
 Type* type
);
[JScript]
public static function GetUninitializedObject(
   type : Type
) : Object;

Parameters

type
The type of object to create.

Return Value

A zeroed object of the specified type.

Exceptions

Exception Type Condition
ArgumentNullException The type parameter is a null reference (Nothing in Visual Basic).
SecurityException The caller does not have the required permission.

Remarks

Because the new instance of the object is initialized to zero and no constructors are run, the object might not represent a state that is regarded as valid by that object. The current method should only be used for deserialization when the user intends to immediately populate all fields. It will not create an uninitialized string, since creating an empty instance of an immutable type serves no purpose.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

FormatterServices Class | FormatterServices Members | System.Runtime.Serialization Namespace

Show:
© 2014 Microsoft. All rights reserved.