Click or drag to resize

ExtensionsReflectionGetPropertyValueT Method (Object, String, BindingFlags)

Searches for the specified property, using the specified binding constraints and returns its value.

Namespace:  Cauldron
Assembly:  Cauldron.Activator (in Cauldron.Activator.dll) Version: 3.2.0.1 (3.2.0.1)
Syntax
C#
public static T GetPropertyValue<T>(
	this Object obj,
	string propertyName,
	BindingFlags bindingFlags
)

Parameters

obj
Type: SystemObject
The Object to retrieve the value from
propertyName
Type: SystemString
The string containing the name of the property to get.
bindingFlags
Type: System.ReflectionBindingFlags
A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

Zero, to return null.

Type Parameters

T
The property's return value type

Return Value

Type: T
The property value of the specified object.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Object. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentNullExceptionobj is null
NullReferenceException The property defined by propertyName was not found
See Also