Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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.

Exception Condition
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

Return to top
Show: