다음을 통해 공유


PrivateObject.GetField Method (String, BindingFlags)

Gets a value from a named field, based on the name and lookup mask.

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

Syntax

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

Parameters

  • name
    Type: String

    The name of the private field to get.

  • bindingFlags
    Type: BindingFlags

Return Value

Type: Object
The value set for the name field.

Exceptions

Exception Condition
ArgumentException

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

.NET Framework Security

See Also

Reference

PrivateObject Class

GetField Overload

Microsoft.VisualStudio.TestTools.UnitTesting Namespace