예제 #1
0
        public void MyTestMethod()
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            var dict =
                CTRCHelper.GetMethodInfos <MethodModel>()
                .ToDictionary(c => c, t => new Dictionary <string, Func <int, int> >
            {
                { "a", (i) => i + 12 },
                { "b", (i) => i + 12 },
                { "c", (i) => i + 12 },
                { "d", (i) => i + 12 },
                { "e", (i) => i + 12 }
            });
            var key = CTRCHelper.GetMethodInfos <MethodModel>().LastOrDefault(c => c.Name == "Generic");

            Console.WriteLine(dict.Count);
            Console.WriteLine(stopwatch.ElapsedMilliseconds);
            var d = EqualityComparer <MethodInfo> .Default;

            for (int i = 0; i < MaxTime; i++)
            {
                //  var t= d.GetHashCode(key);

                //var t = key.Equals(dict.Keys.First());
                var t = dict[key]["a"];
            }
            Console.WriteLine(stopwatch.ElapsedMilliseconds);
        }
예제 #2
0
 public void GetMethodInfosTest()
 {
     //60ms 2 11ms
     for (int i = 0; i < MaxTime; i++)
     {
         var mem = CTRCHelper.GetMethodInfos <MethodModel>();
     }
 }
예제 #3
0
        public void MethodCountTest()
        {
            var methods = CTRCHelper.GetMethodInfos <MethodTestModel>();

            foreach (var m in methods)
            {
                Console.WriteLine(m.Name);
            }
            Assert.AreEqual(3, methods.Length);
        }