Esempio n. 1
0
        public static void Main(string[] args)
        {
            Expression <Func <object, object> > exp = x => ((MyClass)x).Value.Length;

            var m = new MyClass {
                Value = "ssdf",

                /*Nested = new MyClass {
                 *  Value = "asd"
                 * }*/
            };

            RUtils <MyClass> .TrySet(m, "Nested.Nested.Nested.Value", "fdg");

            RUtils <MyClass> .TryGet(m, "Nested.Nested.Nested.Value", out var value);


            RUtils <MyClass> .Set(obj, "Value", "asd");

            RUtils <MyClass> .Get(obj, "Value");

            var summary = BenchmarkRunner.Run <RUtils_Benchmarks>(new Config());

            Console.WriteLine();

            Console.WriteLine("\nString value set and then get");

            var runCount = summary.Reports.Length;// / 2;

            foreach (var report in summary.Reports.Take(runCount).OrderBy(x => x.ResultStatistics.Median))
            {
                var ns    = $"{report.ResultStatistics.Median:N1} ns";
                var spase = new string(' ', 10 - ns.Length);

                Console.WriteLine($"{ns}{spase}{Info(report)}");
            }

            /*
             * Console.WriteLine("\nString value set and then get");
             * foreach (var report in summary.Reports.Skip(runCount).Take(runCount).OrderBy(x => x.ResultStatistics.Median)) {
             *  var ns = $"{report.ResultStatistics.Median:N1} ns";
             *  var spase = new string(' ', 10 - ns.Length);
             *
             *  Console.WriteLine($"{ns}{spase}{Info(report)}");
             * }*/

            /*
             * Console.WriteLine("\nString value set and then get");
             * foreach (var report in summary.Reports.Skip(16).OrderBy(x => x.ResultStatistics.Median)) {
             *  var ns = $"{report.ResultStatistics.Median:N1} ns";
             *  var spase = new string(' ', 10 - ns.Length);
             *
             *  Console.WriteLine($"{ns}{spase}{Info(report)}");
             * }
             */

            Console.WriteLine();
            Console.ReadLine();
        }
Esempio n. 2
0
        public string REtilsSetValue()
        {
            RUtils <MyClass> .Set(obj, "Value", "asd");

            return((string)RUtils <MyClass> .Get(obj, "Value"));
        }