Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

PropertyInfo.GetValue Method (Object, Object[])

Returns the value of the property with optional index values for indexed properties.

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)

public virtual Object GetValue (
	Object obj,
	Object[] index
public Object GetValue (
	Object obj, 
	Object[] index
public function GetValue (
	obj : Object, 
	index : Object[]
) : Object



The object whose property value will be returned.


Optional index values for indexed properties. This value should be a null reference (Nothing in Visual Basic) for non-indexed properties.

Return Value

The property value for the obj parameter.

Exception typeCondition


The index array does not contain the type of arguments needed.


The property's Get method is not found.


The object does not match the target type, or a property is an instance property but obj is a null reference (Nothing in Visual Basic).


The number of parameters in index does not match the number of parameters the indexed property takes.


There was an illegal attempt to access a private or protected method inside a class.

This is a convenience method that provides an implementation for the abstract GetValue method with a BindingFlags parameter of DefaultChangeType, the Binder set to a null reference (Nothing in Visual Basic), and the CultureInfo set to a null reference (Nothing in Visual Basic).

Because static properties belong to the type, not individual objects, get static properties by passing 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 = 
Console.WriteLine("CurrCult: " +

To use the GetValue method, first get the class Type. From the Type, get the PropertyInfo. From the PropertyInfo, use the GetValue method.

  • ReflectionPermission  when invoked late-bound through mechanisms such as Type.InvokeMember. Associated enumeration: ReflectionPermissionFlag.MemberAccess.
  • ReflectionPermission  for reflecting non-public objects. Associated enumeration: ReflectionPermissionFlag.TypeInformation

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

© 2017 Microsoft