共用方式為


PrivateType.GetStaticFieldOrProperty Method (String, BindingFlags)

Gets a value of a static field or property in a wrapped type based on the name.

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

Syntax

'Declaration
Public Function GetStaticFieldOrProperty ( _
    name As String, _
    bindingFlags As BindingFlags _
) As Object
public Object GetStaticFieldOrProperty(
    string name,
    BindingFlags bindingFlags
)
public:
Object^ GetStaticFieldOrProperty(
    String^ name, 
    BindingFlags bindingFlags
)
member GetStaticFieldOrProperty : 
        name:string * 
        bindingFlags:BindingFlags -> Object
public function GetStaticFieldOrProperty(
    name : String, 
    bindingFlags : BindingFlags
) : Object

Parameters

  • name
    Type: String

    The name of the static field or property to get.

  • bindingFlags
    Type: BindingFlags

Return Value

Type: Object
The value set for the name 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

GetStaticFieldOrProperty Overload

Microsoft.VisualStudio.TestTools.UnitTesting Namespace