public static Object? GetProperty(
Object instance,
string propertyName,
bool ignoreCase,
params Object?[]? indexParameters
)
Public Shared Function GetProperty (
instance As Object,
propertyName As String,
ignoreCase As Boolean,
ParamArray indexParameters As Object()
) As Object
public:
static Object^ GetProperty(
Object^ instance,
String^ propertyName,
bool ignoreCase,
... array<Object^>^ indexParameters
)
static member GetProperty :
instance : Object *
propertyName : string *
ignoreCase : bool *
indexParameters : Object[] -> Object
propertyName can refer public and non-public properties. To avoid ambiguity (in case of indexers), this method gets all of the properties of the same name and chooses the first one for which the provided indexParameters match.
If you already have a PropertyInfo instance use the GetProperty(Object, PropertyInfo, ReflectionWays, Object) method for better performance.
If you are not sure whether a property with the specified propertyName exists, then you can use the TryGetProperty methods instead.
For getting the property this method uses the TypeDescriptor way for ICustomTypeDescriptor implementations and the DynamicDelegate way otherwise.