Get Accessible Properties - CSharp System.Reflection

CSharp examples for System.Reflection:Assembly

Description

Get Accessible Properties

Demo Code


using System.Text;
using System.Reflection;
using System.Collections.Generic;
using System.Collections;
using System;//w w w .  ja va  2s  .  c  om

public class Main{
        private static PropertyInfo[] GetAccessibleProperties(Type clazz)
      {
         ArrayList props = new ArrayList();

         foreach(Type iface in clazz.GetInterfaces())
         {
            props.AddRange(iface.GetProperties());
         }

         props.AddRange(clazz.GetProperties());

         return (PropertyInfo[]) props.ToArray(typeof(PropertyInfo));
      }
}

Related Tutorials