NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

PropertyInfo.GetAccessors

[To be supplied.]

Overload List

[To be supplied.]

[Visual Basic] Overloads Public Function GetAccessors() As MethodInfo ()
[C#] public MethodInfo[] GetAccessors();
[C++] public: MethodInfo* GetAccessors() [];
[JScript] public function GetAccessors() : MethodInfo[];

Returns an array of the public, and/or non-public Get and Set accessors on this property.

[Visual Basic] Overloads MustOverride Public Function GetAccessors(Boolean) As MethodInfo ()
[C#] public abstract MethodInfo[] GetAccessors(bool);
[C++] public: virtual MethodInfo* GetAccessors(bool) [] = 0;
[JScript] public abstract function GetAccessors(Boolean) : MethodInfo[];

Example [C#]

Note   This example shows how to use one of the overloaded versions of GetAccessors. For other examples that may be available, see the individual overload topics.

[C#]

//Make a property
public class Myproperty   
{
   private string caption = "A Default caption";
   public string Caption{
      get{return caption;}
      set {if(caption!=value) {caption = value;}
      }
   }
}

class Mypropertyinfo
{
   public static int Main()
      {
      Console.WriteLine ("\nReflection.PropertyInfo");

      //Get the type and PropertyInfo
      Type MyType = Type.GetType("Myproperty");
      PropertyInfo Mypropertyinfo = MyType.GetProperty("Caption");

      //Get the public GetAccessors Method
      MethodInfo[] Mymethodinfoarray = Mypropertyinfo.GetAccessors(true);
      Console.Write ("\nThere are "
         + Mymethodinfoarray.Count + "accessors (public)");
      
      return 0;
   }
}
Produces the following output

Reflection.PropertyInfo
There are 2 accessors (public)

See Also

PropertyInfo Class | PropertyInfo Members | System.Reflection Namespace