Click or drag to resize
PropertyInfoGetValue Method (Object, BindingFlags, Binder, Object, CultureInfo)
When overridden in a derived class, returns the value of a property having the specified binding, index, and CultureInfo.

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public abstract Object GetValue(
	Object obj,
	BindingFlags invokeAttr,
	Binder binder,
	Object[] index,
	CultureInfo culture
)

Parameters

obj
Type: SystemObject
The object whose property value will be returned.
invokeAttr
Type: System.ReflectionBindingFlags
The invocation attribute. This must be a bit flag from BindingFlags : InvokeMethod, CreateInstance, Static, GetField, SetField, GetProperty, or SetProperty. A suitable invocation attribute must be specified. If a static member is to be invoked, the Static flag of BindingFlags must be set.
binder
Type: System.ReflectionBinder
An object that enables the binding, coercion of argument types, invocation of members, and retrieval of MemberInfo objects via reflection. If binder is null, the default binder is used.
index
Type: SystemObject
Optional index values for indexed properties. This value should be null for non-indexed properties.
culture
Type: System.GlobalizationCultureInfo
The CultureInfo object that represents the culture for which the resource is to be localized. Note that if the resource is not localized for this culture, the CultureInfo.Parent method will be called successively in search of a match. If this value is null, the CultureInfo is obtained from the CultureInfo.CurrentUICulture property.

Return Value

Type: Object
The property value for obj.
Exceptions
ExceptionCondition
ArgumentExceptionThe index array does not contain the type of arguments needed.-or- The property's get accessor is not found.
TargetExceptionThe object does not match the target type, or a property is an instance property but obj is null.
TargetParameterCountExceptionThe number of parameters in index does not match the number of parameters the indexed property takes.
MethodAccessExceptionThere was an illegal attempt to access a private or protected method inside a class.
TargetInvocationExceptionAn error occurred while retrieving the property value. For example, an index value specified for an indexed property is out of range. The InnerException property indicates the reason for the error.
See Also