当前位置: 首页>>代码示例>>C#>>正文


C# InvokeMemberBinder.FallbackInvokeMember方法代码示例

本文整理汇总了C#中System.Dynamic.InvokeMemberBinder.FallbackInvokeMember方法的典型用法代码示例。如果您正苦于以下问题:C# InvokeMemberBinder.FallbackInvokeMember方法的具体用法?C# InvokeMemberBinder.FallbackInvokeMember怎么用?C# InvokeMemberBinder.FallbackInvokeMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Dynamic.InvokeMemberBinder的用法示例。


在下文中一共展示了InvokeMemberBinder.FallbackInvokeMember方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BindInvokeMember

            public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args)
            {
                // VbGetBinder calls this method when you read a dynamic property from VB code
                var binderDefault = binder.FallbackInvokeMember(this, args);

                var expression = Expression.Convert(GetIndexExpression(binder.Name), typeof(object));

                var dynamicSuggestion = new DynamicMetaObject(expression, BindingRestrictions.GetTypeRestriction(Expression, LimitType)
                                                                                             .Merge(binderDefault.Restrictions));

                return binder.FallbackInvokeMember(this, args, dynamicSuggestion);
            }
开发者ID:processedbeets,项目名称:ASP.NET-MVC-Scaffolding,代码行数:12,代码来源:DynamicViewModel.cs

示例2: BindInvokeMember

 public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) {
     ContractUtils.RequiresNotNull(binder, "binder");
     return binder.FallbackInvokeMember(UnwrapSelf(), args);
 }
开发者ID:jschementi,项目名称:iron,代码行数:4,代码来源:ComFallbackMetaObject.cs

示例3: BindInvokeMember

            public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) {
                // Generate a tree like:
                //
                // {
                //   object result;
                //   TryInvokeMember(payload, out result)
                //      ? result
                //      : TryGetMember(payload, out result)
                //          ? FallbackInvoke(result)
                //          : fallbackResult
                // }
                //
                // Then it calls FallbackInvokeMember with this tree as the
                // "error", giving the language the option of using this
                // tree or doing .NET binding.
                //
                Fallback fallback = e => binder.FallbackInvokeMember(this, args, e);

                var call = BuildCallMethodWithResult(
                    "TryInvokeMember",
                    binder,
                    DynamicMetaObject.GetExpressions(args),
                    BuildCallMethodWithResult(
                        "TryGetMember",
                        new GetBinderAdapter(binder),
                        NoArgs,
                        fallback(null), 
                        (e) => binder.FallbackInvoke(e, args, null)
                    ),
                    null
                );

                return fallback(call);
            }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:34,代码来源:DynamicObject.cs

示例4: BindInvokeMember

        // Because we don't ComboBind over several MOs and operations, and no one
        // is falling back to this function with MOs that have no values, we
        // don't need to check HasValue.  If we did check, and HasValue == False,
        // then would defer to new InvokeMemberBinder.Defer().
        //
        public override DynamicMetaObject BindInvokeMember(
                InvokeMemberBinder binder, DynamicMetaObject[] args) {
            var flags = BindingFlags.IgnoreCase | BindingFlags.Static |
                        BindingFlags.Public;
            var members = ReflType.GetMember(binder.Name, flags);
            if ((members.Length == 1) && (members[0] is PropertyInfo || 
                                          members[0] is FieldInfo)){
                // NEED TO TEST, should check for delegate value too
                var mem = members[0];
                throw new NotImplementedException();
                //return new DynamicMetaObject(
                //    Expression.Dynamic(
                //        new SymplInvokeBinder(new CallInfo(args.Length)),
                //        typeof(object),
                //        args.Select(a => a.Expression).AddFirst(
                //               Expression.MakeMemberAccess(this.Expression, mem)));

                // Don't test for eventinfos since we do nothing with them now.
            } else {
                // Get MethodInfos with right arg counts.
                var mi_mems = members.
                    Select(m => m as MethodInfo).
                    Where(m => m is MethodInfo &&
                               ((MethodInfo)m).GetParameters().Length ==
                                   args.Length);
                // Get MethodInfos with param types that work for args.  This works
                // for except for value args that need to pass to reftype params. 
                // We could detect that to be smarter and then explicitly StrongBox
                // the args.
                List<MethodInfo> res = new List<MethodInfo>();
                foreach (var mem in mi_mems) {
                    if (RuntimeHelpers.ParametersMatchArguments(
                                           mem.GetParameters(), args)) {
                        res.Add(mem);
                    }
                }
                if (res.Count == 0) {
                    // Sometimes when binding members on TypeModels the member
                    // is an instance member since the Type is an instance of Type.
                    // We fallback to the binder with the Type instance to see if
                    // it binds.  The SymplInvokeMemberBinder does handle this.
                    var typeMO = RuntimeHelpers.GetRuntimeTypeMoFromModel(this);
                    var result = binder.FallbackInvokeMember(typeMO, args, null);
                    return result;
                }
                // True below means generate an instance restriction on the MO.
                // We are only looking at the members defined in this Type instance.
                var restrictions = RuntimeHelpers.GetTargetArgsRestrictions(
                    this, args, true);
                // restrictions and conversion must be done consistently.
                var callArgs = 
                    RuntimeHelpers.ConvertArguments(
                    args, res[0].GetParameters());
                return new DynamicMetaObject(
                   RuntimeHelpers.EnsureObjectResult(
                       Expression.Call(res[0], callArgs)),
                   restrictions);
                // Could hve tried just letting Expr.Call factory do the work,
                // but if there is more than one applicable method using just
                // assignablefrom, Expr.Call throws.  It does not pick a "most
                // applicable" method or any method.

            }
        }
开发者ID:TerabyteX,项目名称:main,代码行数:69,代码来源:Sympl.cs

示例5: BindInvokeMember

 /// <summary>
 /// Performs the binding of the dynamic invoke member operation.
 /// </summary>
 /// <param name="binder">An instance of the <see cref="InvokeMemberBinder"/> that represents the details of the dynamic operation.</param>
 /// <param name="args">An array of <see cref="DynamicMetaObject"/> instances - arguments to the invoke member operation.</param>
 /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
 public virtual DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) {
     ContractUtils.RequiresNotNull(binder, "binder");
     return binder.FallbackInvokeMember(this, args);
 }
开发者ID:joshholmes,项目名称:ironruby,代码行数:10,代码来源:DynamicMetaObject.cs

示例6: BindInvokeMember

 public override DynamicMetaObject/*!*/ BindInvokeMember(InvokeMemberBinder/*!*/ binder, params DynamicMetaObject/*!*/[]/*!*/ args) {
     var self = (IRubyObject)Value;
     return RubyInvokeMemberBinder.TryBind(self.Class.Context, binder, this, args) ?? binder.FallbackInvokeMember(this, args);
 }
开发者ID:joshholmes,项目名称:ironruby,代码行数:4,代码来源:RubyObject.Meta.cs

示例7: BindInvokeMember

 public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) {
     ContractUtils.RequiresNotNull(binder, "binder");
     DynamicMetaObject memberValue = GetDynamicMetaObjectForMember(
         binder.Name, 
         binder.IgnoreCase,
         binder.FallbackInvokeMember(this, args)
     );
     //invoke the member value using the language's binder
     return AddDynamicTestAndDefer(
         binder,
         new DynamicMetaObject[] { this },
         Value.Class,
         null,
         binder.FallbackInvoke(memberValue, args, null)
     );
 }
开发者ID:octavioh,项目名称:ironruby,代码行数:16,代码来源:ExpandoObject.cs

示例8: BindInvokeMember

 public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args)
 {
     return DynamicTryGetMember(binder.Name,
         binder.FallbackInvokeMember(this, args).Expression,
         (tmp) => binder.FallbackInvoke(new DynamicMetaObject(tmp, BindingRestrictions.Empty), args, null).Expression
     );
 }
开发者ID:TerabyteX,项目名称:main,代码行数:7,代码来源:StringDictionaryExpando.cs

示例9: BindInvokeMember

 public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args)
 {
     Fallback fallback = e => binder.FallbackInvokeMember(this, args, e);
     DynamicMetaObject errorSuggestion = this.BuildCallMethodWithResult("TryInvokeMember", binder, GetArgArray(args), this.BuildCallMethodWithResult("TryGetMember", new GetBinderAdapter(binder), NoArgs, fallback(null), e => binder.FallbackInvoke(e, args, null)), null);
     return fallback(errorSuggestion);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:6,代码来源:DynamicObject.cs

示例10: BindInvokeMember

            public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) {
                if (IsOverridden("TryInvokeMember")) {
                    return CallMethodWithResult("TryInvokeMember", binder, GetArgArray(args), (e) => binder.FallbackInvokeMember(this, args, e));
                } else if (IsOverridden("TryGetMember")) {
                    // Generate a tree like:
                    //
                    // {
                    //   object result;
                    //   TryGetMember(payload, out result) ? FallbackInvoke(result) : fallbackResult
                    // }
                    //
                    // Then it calls FallbackInvokeMember with this tree as the
                    // "error", giving the language the option of using this
                    // tree or doing .NET binding.
                    //
                    return CallMethodWithResult(
                        "TryGetMember", new GetBinderAdapter(binder), NoArgs,
                        (e) => binder.FallbackInvokeMember(this, args, e),
                        (e) => binder.FallbackInvoke(e, args, null)
                    );
                }

                return base.BindInvokeMember(binder, args);
            }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:24,代码来源:DynamicObject.cs

示例11: BindInvokeMember

 /// <summary>
 ///     Performs the binding of the dynamic invoke member operation.
 /// </summary>
 /// <param name="binder">
 ///     An instance of the <see cref="T:System.Dynamic.InvokeMemberBinder" /> that represents the details of the dynamic operation.
 /// </param>
 /// <param name="args">
 ///     An array of <see cref="T:System.Dynamic.DynamicMetaObject" /> instances - arguments to the invoke member operation.
 /// </param>
 /// <returns>
 ///     The new <see cref="T:System.Dynamic.DynamicMetaObject" /> representing the result of the binding.
 /// </returns>
 public override DynamicMetaObject BindInvokeMember( InvokeMemberBinder binder, DynamicMetaObject[] args )
 {
     return ApplyBinding( meta => meta.BindInvokeMember( binder, args ),
                          ( target, errorSuggestion ) =>
                          binder.FallbackInvokeMember( target, args, errorSuggestion ) );
 }
开发者ID:idavis,项目名称:Archetype,代码行数:18,代码来源:DelegatingMetaObject.cs

示例12: BindInvokeMember

 public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args)
 {
     return binder.FallbackInvokeMember(UnwrapSelf(), args);
 }
开发者ID:40a,项目名称:PowerShell,代码行数:4,代码来源:ComFallbackMetaObject.cs

示例13: BindInvokeMember

            public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) {
                if (IsOverridden("TryInvokeMember")) {
                    return CallMethodWithResult("TryInvokeMember", binder, GetArgArray(args), (e) => binder.FallbackInvokeMember(this, args, e));
                }

                return base.BindInvokeMember(binder, args);
            }
开发者ID:joshholmes,项目名称:ironruby,代码行数:7,代码来源:DynamicObject.cs

示例14: BindInvokeMember

 public override DynamicMetaObject BindInvokeMember( InvokeMemberBinder binder, DynamicMetaObject[] args )
 {
     return binder.FallbackInvokeMember( _baseMetaObject,
                                         args,
                                         AddTypeRestrictions( _metaObject.BindInvokeMember( binder, args ) ) );
 }
开发者ID:allenwgreaves,项目名称:prototype.ps,代码行数:6,代码来源:Prototype.cs


注:本文中的System.Dynamic.InvokeMemberBinder.FallbackInvokeMember方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。