Reflecting On Members Of A Type : Field « Reflection « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

   public class Tester
   {
      public static void Main()
      {
         Type theType = Type.GetType("System.Reflection.Assembly" );
         Console.WriteLine("\nSingle Type is {0}\n", theType );
         MemberInfo[] mbrInfoArray =theType.GetMembers();
         foreach ( MemberInfo mbrInfo in mbrInfoArray )
         {
            Console.WriteLine( "{0} is a {1}",mbrInfo, mbrInfo.MemberType );
         }
      }
   }








19.4.Field
19.4.1.Get all fields from a Type
19.4.2.List Fields
19.4.3.Deeper Reflection: iterate through the fields of the class
19.4.4.Get/set a field using a FieldInfo
19.4.5.Reflecting On Members Of A Type
19.4.6.Get Type full name and base type and its members