Dela via


PrivateObject Constructor (String, String, array<Object )

Initializes a new instance of the PrivateObject class. This creates the object of the specified type and wraps it in the private object.

Namespace:  Microsoft.VisualStudio.TestTools.UnitTesting
Assembly:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)

Syntax

'Declaration
Public Sub New ( _
    assemblyName As String, _
    typeName As String, _
    ParamArray args As Object() _
)
public PrivateObject(
    string assemblyName,
    string typeName,
    params Object[] args
)
public:
PrivateObject(
    String^ assemblyName, 
    String^ typeName, 
    ... array<Object^>^ args
)
new : 
        assemblyName:string * 
        typeName:string * 
        args:Object[] -> PrivateObject
public function PrivateObject(
    assemblyName : String, 
    typeName : String, 
    ... args : Object[]
)

Parameters

  • assemblyName
    Type: System.String
    Name of the assembly that contains the type.
  • args
    Type: array<System.Object[]
    Arguments to pass to the constructor of the object.

Exceptions

Exception Condition
ArgumentNullException

assemblyName or typeName is nulla null reference (Nothing in Visual Basic).

Remarks

An object is created by using the typeName 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 typeName and args.

RealType

The wrapped object type of the object created from typeName and args.

.NET Framework Security

See Also

Reference

PrivateObject Class

PrivateObject Overload

Microsoft.VisualStudio.TestTools.UnitTesting Namespace