C# TypeInfo GetProperties()

Description

TypeInfo GetProperties() Returns all the public properties of the current Type.

Syntax

TypeInfo.GetProperties() has the following syntax.


public PropertyInfo[] GetProperties()

Returns

TypeInfo.GetProperties() method returns

Example

Returns all the public properties of the current Type.


using System;//ww  w . ja  va  2  s . c  om
using System.Reflection;
using System.Reflection.Emit;

public class MainClass
{
    public static void Main()
    {
        PropertyInfo[] myPropertyInfo = Type.GetType("System.Type").GetProperties();
        Console.WriteLine("Properties of System.Type are:");
        for (int i = 0; i < myPropertyInfo.Length; i++)
        {
            Console.WriteLine(myPropertyInfo[i].ToString());
        }
    }
}




















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo