コード例 #1
0
    public void A()
    {
        Type    t = assembly.GetType("ClassToTest", true);
        dynamic c = Activator.CreateInstance(t);

        c.A();
    }
コード例 #2
0
        static void Main(string[] args)
        {
            dynamic person2 = new Prototype();


            person2.frase = "GUATYYYYY";
            person2.A     = (Action <dynamic>)((self) => Console.WriteLine("Name is '{0}'", self.frase));
            person2.A();

            dynamic person1 = person2.Clone();

            person1.frase = "CARMEN";
            person1.A();

            dynamic person3 = new Prototype();

            person3.MetodoB = (Action <dynamic>)((self) => Console.WriteLine("Metodo B dice '{0}'", self.frase));
            person3.frase   = "Soy la person3";
            person3.MetodoB();

            dynamic obj = person3.BlendWith(person2);

            obj.frase = "Union";
            obj.A();
            obj.MetodoB();
        }