Windows apps
Collapse the table of content
Expand the table of content
Information
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::GetAccessors Method ()

 

Returns an array whose elements reflect the public get and set accessors of the property reflected by the current instance.

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

public:
virtual array<MethodInfo^>^ GetAccessors() sealed

Return Value

Type: array<System.Reflection::MethodInfo^>^

An array of MethodInfo objects that reflect the public get and set accessors of the property reflected by the current instance, if found; otherwise, this method returns an array with zero (0) elements.

To call the GetAccessors method:

  1. Get a Type object that represents the class.

  2. From the Type object, get the PropertyInfo object.

  3. From the PropertyInfo object, call the GetAccessors method.

The following example retrieves the public accessors of the ClassWithProperty.Caption property and displays information about them. It also calls the Invoke method of the setter to set the property value and of the getter to retrieve the property value.

No code example is currently available or this language may not be supported.

ReflectionPermission

when invoked late-bound through mechanisms such as Type::InvokeMember. Associated enumeration: ReflectionPermissionFlag::MemberAccess.

.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2017 Microsoft