反射の小例

2004 ワード

 :ca   code.google.com  icen

class Program

    {

        static void Main(string[] args)

        {

            Assembly assembly = Assembly.Load("code.google.com");

            Ihello hello = (Ihello)assembly.CreateInstance("code.google.com.a");

            hello.printHello("tom");



            Console.ReadLine();

        }

    }



  code.google.com   icen

public class a:Ihello

    {

        public void printHello(string name)

        {

            Console.WriteLine("Hello : "+name);

        }

    }



 



  icen

public interface Ihello

    {

        void printHello(string name);

    }