예제 #1
0
        static void Main(string[] args)
        {
            //DortIslem dortIslem = new DortIslem(2, 3);
            //Console.WriteLine(dortIslem.Topla2());
            //Console.WriteLine(dortIslem.Topla(3, 4));

            var type = typeof(DortIslem);
            //DortIslem dortislem = (DortIslem)Activator.CreateInstance(type, 6, 7);
            //Console.WriteLine(dortislem.Topla(4, 5));
            //Console.WriteLine(dortislem.Topla2());
            var        instance   = Activator.CreateInstance(type, 6, 7);
            MethodInfo methodInfo = instance.GetType().GetMethod("Topla2");

            Console.WriteLine(methodInfo.Invoke(instance, null));


            var methods = type.GetMethods();

            foreach (var info in methods)
            {
                Console.WriteLine("Method adi :{0}", info.Name);
                foreach (var parametreInfo in info.GetParameters())
                {
                    Console.WriteLine("Parametre adi : {0}", parametreInfo.Name);
                }
                foreach (var Upper in info.GetCustomAttributes())
                {
                    Console.WriteLine("Parametre adi : {0}", Upper.GetType());
                }
            }
        }