PrivateObject Constructor (Object, String)
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)
Syntax
'Declaration
Public Sub New ( _
obj As Object, _
memberToAccess As String _
)
public PrivateObject(
Object obj,
string memberToAccess
)
public:
PrivateObject(
Object^ obj,
String^ memberToAccess
)
new :
obj:Object *
memberToAccess:string -> PrivateObject
public function PrivateObject(
obj : Object,
memberToAccess : String
)
Parameters
obj
Type: ObjectThe object to wrap. This serves as starting point to reach the private members.
memberToAccess
Type: StringThe dereferencing string that points to the object to be retrieved. This takes the form of "objectX.objectY.objectZ".
Exceptions
Exception | Condition |
---|---|
ArgumentException | memberToAccess is a zero-length string |
ArgumentNullException | obj is nulla null reference (Nothing in Visual Basic) or memberToAccess is nulla null reference (Nothing in Visual Basic) |
.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.