posted by 방랑군 2009. 9. 24. 17:02



using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;


namespace Console_AOP

{

    class Program

    {

        static void Main(string[] args)

        {   


            /// string으로  객체 타입을 얻는다

            /// - typeName :System.Type.AssemblyQualifiedName

            ///

            Type atype = Type.GetType("Console_AOP.TEST, Console_AOP");

            // == Type atype = Type.GetType("Console_AOP.TEST");


            object a = System.Activator.CreateInstance(atype);


            TEST test = (TEST)a;


            Console.Write(test.GetAddress(10));

        }

    }



    class TEST

    {


        public string _Name;

        public string _HP;


        public string GetAddress(int _NO)

        {

            return "서울시 양천구 목2동 537-20";

        }

    }

}



결과 : 
서울시 양천구 목2동 537-20