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

PrivateObject Constructor (Type, Object[])

Initializes a new instance of the PrivateObject class that creates the wrapper for the specified object.

Namespace:  Microsoft.VisualStudio.TestTools.UnitTesting
Assembly:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)
public PrivateObject(
	Type type,
	params Object[] args
)

Parameters

type
Type: System.Type

The wrapped object type.

args
Type: System.Object[]

The arguments to define the object.

ExceptionCondition
ArgumentNullException

type is null.

ArgumentException

type is not a RuntimeType.

NotSupportedException

type cannot be a TypeBuilder.

-or-

Creation of TypedReference, ArgIterator, and RuntimeArgumentHandle types is not supported.

TargetInvocationException

The constructor being called throws an exception.

COMException

type is a COM object but the class identifier used to obtain the type is invalid, or the identified class is not registered.

TypeLoadException

type is not a valid type.

MissingMethodException

No matching public constructor was found to match the type and args.

An object is created by using the type and args.

The following table shows initial property values for an instance of the PrivateObject class instantiated with PrivateObject.

Property

Value

Target

The object created from type and args.

RealType

The wrapped object type

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.