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() _
)
'Usage
Dim assemblyName As String
Dim typeName As String
Dim parameterTypes As Type()
Dim args As Object()
Dim instance As New PrivateObject(assemblyName, _
typeName, parameterTypes, args)
public PrivateObject(
string assemblyName,
string typeName,
Type[] parameterTypes,
Object[] args
)
public:
PrivateObject(
String^ assemblyName,
String^ typeName,
array<Type^>^ parameterTypes,
array<Object^>^ args
)
public function PrivateObject(
assemblyName : String,
typeName : String,
parameterTypes : Type[],
args : Object[]
)
Parameters
assemblyName
Type: System.StringName of the assembly that contains the type.
typeName
Type: System.StringFully qualified name of the type.
parameterTypes
Type: array<System.Type[]An array of Type objects representing the number, order, and type of the parameters for constructing the object.
args
Type: array<System.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. |
Remarks
Smart Device Developer Notes
The Device Unit Test Framework (Microsoft.VisualStudio.SmartDevice.UnitTestFramework.dll) version of this method does not support calls where parameterTypes is null and args is non-null.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.