/// <summary> /// Creates the call site. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="binder">The binder.</param> /// <param name="name">The name.</param> /// <param name="context">The context.</param> /// <param name="argNames">The arg names.</param> /// <param name="staticContext">if set to <c>true</c> [static context].</param> /// <param name="isEvent">if set to <c>true</c> [is event].</param> /// <returns></returns> /// /// /// <example> /// Unit test that exhibits usage /// <code><![CDATA[ /// string tResult = String.Empty; /// var tPoco = new MethOutPoco(); /// var tBinder = /// Binder.InvokeMember(BinderFlags.None, "Func", null, GetType(), /// new[] /// { /// Info.Create( /// InfoFlags.None, null), /// Info.Create( /// InfoFlags.IsOut | /// InfoFlags.UseCompileTimeType, null) /// }); /// var tSite = Impromptu.CreateCallSite<DynamicTryString>(tBinder); /// tSite.Target.Invoke(tSite, tPoco, out tResult); /// Assert.AreEqual("success", tResult); /// ]]></code> /// </example> /// <seealso cref="CreateCallSite"/> public static CallSite <T> CreateCallSite <T>(CallSiteBinder binder, String_OR_InvokeMemberName name, Type context, string[] argNames = null, bool staticContext = false, bool isEvent = false) where T : class { return(InvokeHelper.CreateCallSite <T>(binder.GetType(), InvokeHelper.Unknown, () => binder, name, context, argNames, staticContext, isEvent)); }
/// <summary> /// Creates a cached call site at runtime. /// </summary> /// <param name="delegateType">Type of the delegate.</param> /// <param name="binder">The CallSite binder.</param> /// <param name="name">Member Name</param> /// <param name="context">Permissions Context type</param> /// <param name="argNames">The arg names.</param> /// <param name="staticContext">if set to <c>true</c> [static context].</param> /// <param name="isEvent">if set to <c>true</c> [is event].</param> /// <returns>The CallSite</returns> /// <remarks> /// Advanced usage only for serious custom dynamic invocation. /// </remarks> /// <seealso cref="CreateCallSite{T}"/> public static CallSite CreateCallSite(Type delegateType, CallSiteBinder binder, String_OR_InvokeMemberName name, Type context, string[] argNames = null, bool staticContext = false, bool isEvent = false) { return(InvokeHelper.CreateCallSite(delegateType, binder.GetType(), InvokeHelper.Unknown, () => binder, name, context, argNames, staticContext, isEvent)); }