public static void TestObjectVsTypedNewGetPropertyValue()
        {
            var test = new TestReflectionUtility();

            test.String = "XXX";

            Stopwatch timer = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                ReflectionUtility.GetPropertyValue(test, "String");
            }

            timer.Stop();
            Console.WriteLine(string.Format("Elapsed para obj: {0}", timer.Elapsed));

            timer = Stopwatch.StartNew();
            for (int i = 0; i < 1000000; i++)
            {
                ReflectionUtility.GetPropertyValue <string>(test, "String");
            }

            timer.Stop();
            Console.WriteLine(string.Format("Elapsed para T: {0}", timer.Elapsed));
        }
        public void TestGetPropertyValue()
        {
            var test = new TestReflectionUtility();

            test.String  = "XXX";
            test.Int     = 999;
            test.Long    = 999;
            test.Decimal = Decimal.Parse("999,5");
            test.Date    = new DateTime(1972, 12, 5);
            test.Bool    = true;

            Assert.AreEqual("XXX", ReflectionUtility.GetPropertyValue <string>(test, "String"));
            Assert.AreEqual(999, ReflectionUtility.GetPropertyValue <int>(test, "Int"));
            Assert.AreEqual(999, ReflectionUtility.GetPropertyValue <long>(test, "Long"));
            Assert.AreEqual(Decimal.Parse("999,5"), ReflectionUtility.GetPropertyValue <decimal>(test, "Decimal"));
            Assert.AreEqual(new DateTime(1972, 12, 5), ReflectionUtility.GetPropertyValue <DateTime>(test, "Date"));
            Assert.AreEqual(true, ReflectionUtility.GetPropertyValue <bool>(test, "Bool"));
        }
        public static void TestObjectVsTypedNewGetPropertyValue()
        {
            var test = new TestReflectionUtility();
            test.String = "XXX";

            Stopwatch timer = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                ReflectionUtility.GetPropertyValue(test, "String");
            }

            timer.Stop();
            Console.WriteLine(string.Format("Elapsed para obj: {0}", timer.Elapsed));

            timer = Stopwatch.StartNew();
            for (int i = 0; i < 1000000; i++)
            {
                ReflectionUtility.GetPropertyValue<string>(test, "String");
            }

            timer.Stop();
            Console.WriteLine(string.Format("Elapsed para T: {0}", timer.Elapsed));
        }
        public void TestGetPropertyValue()
        {
            var test = new TestReflectionUtility();
            test.String = "XXX";
            test.Int = 999;
            test.Long = 999;
            test.Decimal = Decimal.Parse("999,5");
            test.Date = new DateTime(1972, 12, 5);
            test.Bool = true;

            Assert.AreEqual("XXX", ReflectionUtility.GetPropertyValue<string>(test, "String"));
            Assert.AreEqual(999, ReflectionUtility.GetPropertyValue<int>(test, "Int"));
            Assert.AreEqual(999, ReflectionUtility.GetPropertyValue<long>(test, "Long"));
            Assert.AreEqual(Decimal.Parse("999,5"), ReflectionUtility.GetPropertyValue<decimal>(test, "Decimal"));
            Assert.AreEqual(new DateTime(1972, 12, 5), ReflectionUtility.GetPropertyValue<DateTime>(test, "Date"));
            Assert.AreEqual(true, ReflectionUtility.GetPropertyValue<bool>(test, "Bool"));
        }