Type.GetProperties() : Type « System « C# / C Sharp by API






Type.GetProperties()

  
using System;
using System.Reflection;


public class Test
{
    public static void Main(string[] args)
    {
    TheType.MyClass aClass = new TheType.MyClass();

    Type t = aClass.GetType();
    PropertyInfo[] pi = t.GetProperties();
    foreach(PropertyInfo prop in pi)
      Console.WriteLine("Prop: {0}",  prop.Name);

    }
}



namespace TheType {
    public interface IFaceOne {
      void MethodA();
    }
    
    public interface IFaceTwo {
      void MethodB();
    }
    
    public class MyClass: IFaceOne, IFaceTwo {
      public int myIntField;
      public string myStringField;
        private double myDoubleField = 0;
        
        
        public double getMyDouble(){
          return myDoubleField;
        }
        
      public void myMethod(int p1, string p2)
      {
      }
    
      public int MyProp
      {
        get { return myIntField; }
        set { myIntField = value; }
      }
    
      public void MethodA() {}
      public void MethodB() {}
    }
}

   
    
  








Related examples in the same category

1.Type.BaseType
2.Type.ContainsGenericParameters
3.Type.FullName
4.Type.GetConstructor
5.Type.GetCustomAttributes
6.Type.GetEvents()
7.Type.GetFields()
8.Type.GetGenericArguments()
9.Type.GetGenericTypeDefinition()
10.Type.GetInterfaces()
11.Type.GetMethod(String methodName);
12.Type.GetMethods()
13.Type.GetType(String typeName)
14.Type.GetType(String typeName, true)
15.Type.GetType(String typeName, true, true);
16.Type.IsAbstract
17.Type.IsClass
18.Type.IsCOMObject
19.Type.IsEnum
20.Type.IsGenericTypeDefinition
21.Type.IsSealed
22.Type.MakeGenericType
23.Type.Name
24.Type.ReflectionOnlyGetType
25.Type.UnderlyingSystemType