Method CreateBeginInvokeMethod(ICallableType anonymousType)
{
Method method = CodeBuilder.CreateRuntimeMethod("BeginInvoke", TypeSystemServices.Map(typeof(IAsyncResult)),
anonymousType.GetSignature().Parameters, false);
int delta = method.Parameters.Count;
method.Parameters.Add(
CodeBuilder.CreateParameterDeclaration(delta + 1, "callback", TypeSystemServices.Map(typeof(AsyncCallback))));
method.Parameters.Add(
CodeBuilder.CreateParameterDeclaration(delta + 1, "asyncState", TypeSystemServices.ObjectType));
return method;
}