Mega Code Archive

 
Categories / C# / Reflection
 

Returns all the public properties of the current Type

using System; using System.Reflection; using System.Reflection.Emit; public class TypeMain {     public static void Main()      {         PropertyInfo[] myPropertyInfo;         // Get the properties of 'Type' class object.         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());         }     } }