Share via


PrivateObject.SetFieldOrProperty Method (String, BindingFlags, Object)

Sets a value of a wrapped field or property based on the name.

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

Syntax

'Declaration
Public Sub SetFieldOrProperty ( _
    name As String, _
    bindingFlags As BindingFlags, _
    value As Object _
)
public void SetFieldOrProperty(
    string name,
    BindingFlags bindingFlags,
    Object value
)
public:
void SetFieldOrProperty(
    String^ name, 
    BindingFlags bindingFlags, 
    Object^ value
)
member SetFieldOrProperty : 
        name:string * 
        bindingFlags:BindingFlags * 
        value:Object -> unit
public function SetFieldOrProperty(
    name : String, 
    bindingFlags : BindingFlags, 
    value : Object
)

Parameters

  • name
    Type: String

    The name of the private field or property to set.

  • bindingFlags
    Type: BindingFlags
  • value
    Type: Object

    The value to set for name.

Remarks

Important

This is important for Visual Basic source code as fields and properties are used the same way.

.NET Framework Security

See Also

Reference

PrivateObject Class

SetFieldOrProperty Overload

Microsoft.VisualStudio.TestTools.UnitTesting Namespace