PrivateObject.SetProperty Method (String, BindingFlags, Object, array<Object[])

Sets a property for a wrapped object identified by name with binding flags.

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

Syntax

'Declaration
Public Sub SetProperty ( _
    name As String, _
    invokeAttr As BindingFlags, _
    value As Object, _
    ParamArray args As Object() _
)
'Usage
Dim instance As PrivateObject 
Dim name As String 
Dim invokeAttr As BindingFlags 
Dim value As Object 
Dim args As Object()

instance.SetProperty(name, invokeAttr, _
    value, args)
public void SetProperty(
    string name,
    BindingFlags invokeAttr,
    Object value,
    params Object[] args
)
public:
void SetProperty(
    String^ name, 
    BindingFlags invokeAttr, 
    Object^ value, 
    ... array<Object^>^ args
)
public function SetProperty(
    name : String, 
    invokeAttr : BindingFlags, 
    value : Object, 
    ... args : Object[]
)

Parameters

  • invokeAttr
    Type: System.Reflection.BindingFlags

    A bitmask comprised of one or more BindingFlags that specifies how the search for the property is conducted. The type of lookup need not be specified. The default value is SetProperty. If nulla null reference (Nothing in Visual Basic) is used, the default value is passed. Additional flags will be added to the mask.

  • value
    Type: System.Object

    The value to set the property identified by name.

  • args
    Type: array<System.Object[]

    An array that contains the arguments to pass to the property to invoke.

Exceptions

Exception Condition
ArgumentException

name is nulla null reference (Nothing in Visual Basic) or empty.

.NET Framework Security

See Also

Reference

PrivateObject Class

PrivateObject Members

SetProperty Overload

Microsoft.VisualStudio.TestTools.UnitTesting Namespace