共用方式為


PrivateType.SetStaticFieldOrProperty Method (String, BindingFlags, Object)

Sets a static field or property contained in the wrapped type.

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

Syntax

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

Parameters

  • name
    Type: String

    The name of the static field or property.

  • bindingFlags
    Type: BindingFlags
  • value
    Type: Object

    The value to set to the static field or property.

Remarks

Important

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

.NET Framework Security

See Also

Reference

PrivateType Class

SetStaticFieldOrProperty Overload

Microsoft.VisualStudio.TestTools.UnitTesting Namespace