1.13. fejezet, Reflection

namespace ReflectionProject
{
 
    class Example
    {
        private int factor;
 
        public Example(int f)
        {
            factor = f;
        }
 
        public int SampleMethod(int x)
        {
            Console.WriteLine("\nExample.SampleMethod({0}) executes.", x);
            return x * factor;
        }
 
        static void Main(string[] args)
        {
            Assembly assem = typeof(Example).Assembly;
 
            Console.WriteLine("Assembly Full Name:");
            Console.WriteLine(assem.FullName);
 
            AssemblyName assemName = assem.GetName();
            Console.WriteLine("\nName: {0}", assemName.Name);
            Console.WriteLine("Version: {0}.{1}",
                assemName.Version.Major, assemName.Version.Minor);
 
            Console.WriteLine("\nAssembly CodeBase:");
            Console.WriteLine(assem.CodeBase);
 
            Object o = assem.CreateInstance("ReflectionProject.Example", false,
                BindingFlags.ExactBinding,
                null, new Object[] { 2 }, null, null);
 
            // Make a late-bound call to an instance method of the object.    
            MethodInfo m = assem.GetType("ReflectionProject.Example").GetMethod("SampleMethod");
            Object ret = m.Invoke(o, new Object[] { 42 });
            Console.WriteLine("SampleMethod returned {0}.", ret);
 
            Console.WriteLine("\nAssembly entry point:");
            Console.WriteLine(assem.EntryPoint);
        }
    }
}

Részletek itt.