共用方式為


PrivateObject.GetProperty Method (String, BindingFlags, array<Object )

Gets 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 Function GetProperty ( _
    name As String, _
    bindingFlags As BindingFlags, _
    ParamArray args As Object() _
) As Object
public Object GetProperty(
    string name,
    BindingFlags bindingFlags,
    params Object[] args
)
public:
Object^ GetProperty(
    String^ name, 
    BindingFlags bindingFlags, 
    ... array<Object^>^ args
)
member GetProperty : 
        name:string * 
        bindingFlags:BindingFlags * 
        args:Object[] -> Object
public function GetProperty(
    name : String, 
    bindingFlags : BindingFlags, 
    ... args : Object[]
) : Object

Parameters

  • name
    Type: String

    The name of property to get.

  • bindingFlags
    Type: BindingFlags
  • args
    Type: array<Object[]

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

Return Value

Type: Object
An object that contains the value of the property identified by name.

Exceptions

Exception Condition
ArgumentException

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

.NET Framework Security

See Also

Reference

PrivateObject Class

GetProperty Overload

Microsoft.VisualStudio.TestTools.UnitTesting Namespace