Partager via


PrivateObject Constructor (String, String, array<Type[], array<Object )

Initializes a new instance of the PrivateObject class. This creates an 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, _
    parameterTypes As Type(), _
    args As Object() _
)
public PrivateObject(
    string assemblyName,
    string typeName,
    Type[] parameterTypes,
    Object[] args
)
public:
PrivateObject(
    String^ assemblyName, 
    String^ typeName, 
    array<Type^>^ parameterTypes, 
    array<Object^>^ args
)
new : 
        assemblyName:string * 
        typeName:string * 
        parameterTypes:Type[] * 
        args:Object[] -> PrivateObject
public function PrivateObject(
    assemblyName : String, 
    typeName : String, 
    parameterTypes : Type[], 
    args : Object[]
)

Parameters

  • assemblyName
    Type: String

    Name of the assembly that contains the type.

  • typeName
    Type: String

    Fully qualified name of the type.

  • parameterTypes
    Type: array<Type[]

    An array of Type objects representing the number, order, and type of the parameters for constructing the object.

  • args
    Type: array<Object[]

    The arguments to define the object.

Exceptions

Exception Condition
ArgumentNullException

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

ArgumentException

parameterTypes is multidimensional.

-or-

A constructor cannot be found to match the parameters specified in PrivateObject.

.NET Framework Security

See Also

Reference

PrivateObject Class

PrivateObject Overload

Microsoft.VisualStudio.TestTools.UnitTesting Namespace