private delegate TResult RefFunc<TArg, TResult>(ref TArg arg);
private static bool TryGetDelegate<T>(string memberName, out RefFunc<T, bool> @delegate)
{
System.Type typeOfT = typeof(T);
MethodInfo method = typeOfT.GetMethod(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new System.Type[] { }, null);
if (method == null)
{
@delegate = null;
return false;
}
@delegate = (RefFunc<T, bool>)System.Delegate.CreateDelegate(typeof(RefFunc<T, bool>), null, method); // The error occures here
return true;
}
private delegate TResult RefFunc<TArg, TResult>(ref TArg arg);
private static bool TryGetDelegate<T>(string memberName, out RefFunc<T, bool> @delegate)
{
System.Type typeOfT = typeof(T);
MethodInfo method = typeOfT.GetMethod(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new System.Type[] { }, null);
if (method == null)
{
@delegate = null;
return false;
}
@delegate = (RefFunc<T, bool>)System.Delegate.CreateDelegate(typeof(RefFunc<T, bool>), null, method); // The error occures here
return true;
}