Exemple #1
0
        public void PerfTestWithObjectString()
        {
            void OnMsg(string x)
            {
                if (x == "end")
                {
                    Console.WriteLine(x);
                }
            }

            ActionFactory <string> fact = new ActionFactory <string>(OnMsg);
            Stopwatch watch             = Stopwatch.StartNew();

            for (int i = 0; i < 5000000; i++)
            {
                Action act = fact.CreateObject("s");
                act();
            }

            fact.Create("end")();
            watch.Stop();
            Console.WriteLine("Elapsed: " + watch.ElapsedMilliseconds);
        }