public Furniture()
        {
            this.HiddenInt      = 500;
            this.OtherHiddenInt = 951;
            this.VisibleInt     = 499;

            Console.WriteLine(WorkWithReflection.GetCurrentMethod());
        }
Beispiel #2
0
        private static void UsingReflection()
        {
            Console.WriteLine(WorkWithReflection.GetCurrentMethod());

            Furniture furniture = new Furniture {
                Id = 1, Name = "CHAIR", Price = 1.23
            };

            Console.WriteLine("Ex 1 Dump an object:");
            WorkWithReflection.DumpObject(furniture);
            Console.WriteLine();

            Console.WriteLine("Ex 2 Invoke methods:");
            WorkWithReflection.InvokeMethods(furniture);
            Console.WriteLine();

            List <Employee> employees = new List <Employee>()
            {
                new Employee()
                {
                    Name = "Lou", Category = 12
                },
                new Employee()
                {
                    Name = "Wayne", Category = 8
                },
            };

            Console.WriteLine("Ex 3 Invoke other methods:");
            WorkWithReflection.InvokeMethodNoArgument(employees[0], employees[1], "CompareTo", typeof(Employee));
            Console.WriteLine();

            WorkWithReflection.CompanyTestAttribute();

            WorkWithReflection.GetFolderClasses();
        }