public void FastCompiledOK()
        {
            var executor = ObjectMethodExecutorCompiledFast.Create(_t.GetMethod(TestMethodName), _ti);

            Assert.IsNotNull(executor);
            Assert.IsTrue(executor.IsMethodAsync);

            var sumTask = (Task <int>)executor.Execute(this, new object[] { 1, 2 });

            Assert.AreEqual(3, sumTask.Result);

            var sum = executor.ExecuteAsync(this, new object[] { 1, 2 });

            Assert.AreEqual(3, sum.GetAwaiter().GetResult());
        }
コード例 #2
0
 public object CompileFast() =>
 ObjectMethodExecutorCompiledFast.Create(_t.GetMethod(nameof(Foo)), _t.GetTypeInfo());
コード例 #3
0
ファイル: ReflectionUtils.cs プロジェクト: xxCherry/oyasumi
 public static ObjectMethodExecutorCompiledFast GetExecutor(MethodInfo meth)
 {
     return(ObjectMethodExecutorCompiledFast.Create(meth, meth.DeclaringType.GetTypeInfo()));
 }