コード例 #1
0
        private static string MugenBindingTest(int count)
        {
            var target = new TestModel();
            var model = new BindingPerformanceModel(target);
            target.Bind(() => t => t.Value)
                .To(model, () => (vm, ctx) => vm.Property)
                .TwoWay()
                .Build();

            Stopwatch startNew = Stopwatch.StartNew();
            for (int i = 0; i < count; i++)
                target.Value = i % 2 == 0 ? "0" : "1";
            startNew.Stop();

            if (model.SetCount != count)
                throw new Exception();
            return startNew.Elapsed.ToString();
        }
コード例 #2
0
        private static string MugenBindingExpTest(int count)
        {
            var target = new TestModel();
            var model  = new BindingPerformanceModel(target);

            target.Bind(() => m => m.Value)
            .To(model, () => (vm, ctx) => (vm.Property ?? string.Empty).Length + vm.Property)
            .Build();

            Stopwatch startNew = Stopwatch.StartNew();

            for (int i = 0; i < count; i++)
            {
                model.Property = i % 2 == 0 ? "0" : "1";
            }
            startNew.Stop();

            if (model.SetCount != count)
            {
                throw new Exception();
            }
            return(startNew.Elapsed.ToString());
        }
コード例 #3
0
        private static string MugenBindingTest(int count)
        {
            var target = new TestModel();
            var model  = new BindingPerformanceModel(target);

            target.Bind(() => t => t.Value)
            .To(model, () => (vm, ctx) => vm.Property)
            .TwoWay()
            .Build();

            var startNew = Stopwatch.StartNew();

            for (var i = 0; i < count; i++)
            {
                target.Value = i % 2 == 0 ? "0" : "1";
            }
            startNew.Stop();

            if (model.SetCount != count)
            {
                throw new Exception();
            }
            return(startNew.Elapsed.ToString());
        }
コード例 #4
0
        private static string MugenBindingExpTest(int count)
        {
            var target = new TestModel();
            var model = new BindingPerformanceModel(target);
            target.Bind(() => m => m.Value)
                .To(model, () => pm => (pm.Property ?? string.Empty).Length + pm.Property)
                .Build();

            Stopwatch startNew = Stopwatch.StartNew();
            for (int i = 0; i < count; i++)
                model.Property = i % 2 == 0 ? "0" : "1";
            startNew.Stop();

            if (model.SetCount != count)
                throw new Exception();
            return startNew.Elapsed.ToString();
        }