System.Reflection.PropertyInfo.GetAccessors Method

Returns an array whose elements reflect the public and, if specified, non-public get, set, and other accessors of the property reflected by the current instance.

Syntax

public abstract MethodInfo[] GetAccessors (bool nonPublic)

Parameters

nonPublic
Indicates whether non-public methods should be returned in the MethodInfo array. true if non-public methods are to be included; otherwise, false.

Returns

An array of System.Reflection.MethodInfo objects whose elements reflect the get, set, and other accessors of the property reflected by the current instance. If nonPublic is true, this array contains public and non-public get, set, and other accessors. If nonPublic is false, this array contains only public get, set, and other accessors. If no accessors with the specified visibility are found, this method returns an array with zero (0) elements.

Remarks

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

Permissions

TypeReason
System.Security.Permissions.ReflectionPermissionRequires permission to reflect non-public members of a type in loaded assemblies. See System.Security.Permissions.ReflectionPermissionFlag.TypeInformation.

Requirements

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0