Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Returns the property value of a specified object with optional index values for indexed properties.
Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Overridable Function GetValue ( _
obj As Object, _
index As Object() _
) As Object
public virtual Object GetValue(
Object obj,
Object[] index
)
public:
virtual Object^ GetValue(
Object^ obj,
array<Object^>^ index
)
abstract GetValue :
obj:Object *
index:Object[] -> Object
override GetValue :
obj:Object *
index:Object[] -> Object
public function GetValue(
obj : Object,
index : Object[]
) : Object
Parameters
- obj
Type: System. . :: . .Object
The object whose property value will be returned.
- index
Type: array<System. . :: . .Object> [] () [] []
Optional index values for indexed properties. This value should be nullNothingnullptrunita null reference (Nothing in Visual Basic) for non-indexed properties.
Return Value
Type: System. . :: . .Object
The property value of the specified object.
Remarks
To determine whether a property is indexed, use the GetIndexParameters method. If the resulting array has 0 (zero) elements, the property is not indexed.
This is a convenience method that provides an implementation for the abstract GetValue method with a BindingFlags parameter of Default, the Binder set to null Nothing nullptr unit a null reference (Nothing in Visual Basic) , and the CultureInfo set to null Nothing nullptr unit a null reference (Nothing in Visual Basic) .
Because static properties belong to the type, not individual objects, get static properties by passing null Nothing nullptr unit a null reference (Nothing in Visual Basic) as the object argument. For example, use the following code to get the static CurrentCulture property of CultureInfo :
PropertyInfo CurCultProp =
(typeof(CultureInfo)).GetProperty("CurrentCulture");
Console.WriteLine("CurrCult: " +
CurCultProp.GetValue(null,null));
To use the GetValue method, first get the class Type. From the Type, get the PropertyInfo. From the PropertyInfo, use the GetValue method.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.