本文整理汇总了C#中Func.GetMethodInfo方法的典型用法代码示例。如果您正苦于以下问题:C# Func.GetMethodInfo方法的具体用法?C# Func.GetMethodInfo怎么用?C# Func.GetMethodInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func.GetMethodInfo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoteInvoke
/// <summary>Invokes the method from this assembly in another process using the specified arguments.</summary>
/// <param name="method">The method to invoke.</param>
/// <param name="arg1">The first argument to pass to the method.</param>
/// <param name="arg2">The second argument to pass to the method.</param>
/// <param name="arg3">The third argument to pass to the method.</param>
/// <param name="options">Options to use for the invocation.</param>
internal static RemoteInvokeHandle RemoteInvoke(
Func<string, string, string, int> method,
string arg1, string arg2, string arg3,
RemoteInvokeOptions options = null)
{
return RemoteInvoke(method.GetMethodInfo(), new[] { arg1, arg2, arg3 }, options);
}
示例2: RemoteInvoke
/// <summary>Invokes the method from this assembly in another process using the specified arguments.</summary>
/// <param name="method">The method to invoke.</param>
/// <param name="start">true if this function should Start the Process; false if that responsibility is left up to the caller.</param>
internal static RemoteInvokeHandle RemoteInvoke(
Func<int> method,
bool start = true,
ProcessStartInfo psi = null)
{
return RemoteInvoke(method.GetMethodInfo(), Array.Empty<string>(), start, psi);
}
示例3: ILBytesForDifferentDelegatesAreTheSameTest
public void ILBytesForDifferentDelegatesAreTheSameTest()
{
var x = new Func<object, int>(y => 0);
var z = new Func<object, int>(y => 0);
Assert.False(x == z);
var xBytes = x.GetMethodInfo().GetILBytes();
Assert.False(xBytes.IsNullOrEmpty());
var zBytes = x.GetMethodInfo().GetILBytes();
Assert.False(zBytes.IsNullOrEmpty());
Assert.True(xBytes.EqualTo(zBytes));
}
示例4: ILBytesForDelegateAreAvailableTest
public void ILBytesForDelegateAreAvailableTest()
{
var x = new Func<object, int>(y => 0);
var bytes = x.GetMethodInfo().GetILBytes();
Assert.False(bytes.IsNullOrEmpty());
}
示例5: Run
public static void Run(this ApplicationInstance applicationInstance,
Func<Task> staticMethodToExecute,
TestInjectorSettings testInjectorSettings = null)
{
var methodInfo =
#if NET40
staticMethodToExecute.Method;
#else
staticMethodToExecute.GetMethodInfo();
#endif
if (!methodInfo.IsStatic)
throw new InvalidOperationException("Method must be static - don't reference any outside parameters");
RunMethodImpl(applicationInstance, methodInfo, testInjectorSettings);
}
示例6: InjectionFactory
public InjectionFactory(Func<IUnityContainer, object> factoryFunc)
{
var parameters = new Expression[] { Expression.Constant(DummyContainer) };
this.Factory = factoryFunc.Target == null ? Expression.Call(factoryFunc.GetMethodInfo(), parameters) : Expression.Call(Expression.Constant(factoryFunc.Target), factoryFunc.GetMethodInfo(), parameters);
}