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


C# ConvertBinder.FallbackConvert方法代码示例

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


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

示例1: BindConvert

 public override DynamicMetaObject/*!*/ BindConvert(ConvertBinder/*!*/ binder) {
     var protocolConversion = ProtocolConversionAction.TryGetDefaultConversionAction(Context, binder.Type);
     if (protocolConversion != null) {
         return protocolConversion.Bind(this, DynamicMetaObject.EmptyMetaObjects);
     } else {
         return binder.FallbackConvert(this);
     }
 }
开发者ID:ExpertsInside,项目名称:IronSP,代码行数:8,代码来源:RubyMetaObject.cs

示例2: BindConvert

            public override DynamicMetaObject BindConvert(ConvertBinder binder) {
                if (IsOverridden("TryConvert")) {
                    return CallMethodWithResult("TryConvert", binder, NoArgs, (e) => binder.FallbackConvert(this, e));
                }

                return base.BindConvert(binder);
            }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:DynamicObject.cs

示例3: BindConvert

 /// <summary>
 /// Performs the binding of the dynamic conversion operation.
 /// </summary>
 /// <param name="binder">An instance of the <see cref="ConvertBinder"/> that represents the details of the dynamic operation.</param>
 /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
 public virtual DynamicMetaObject BindConvert(ConvertBinder binder) {
     ContractUtils.RequiresNotNull(binder, "binder");
     return binder.FallbackConvert(this);
 }
开发者ID:joshholmes,项目名称:ironruby,代码行数:9,代码来源:DynamicMetaObject.cs

示例4: BindConvert

            public override DynamicMetaObject BindConvert(ConvertBinder binder)
            {
                var type = binder.Type;
                if (binder is TotemConversionBinder)
                    type = ((TotemConversionBinder)binder).Type;

                var conversions = _type.GetConversions(type, binder.Explicit);
                foreach (var c in conversions)
                {
                    var ret = c(_type, this);
                    if (ret != null)
                    {
                        if (ret.Expression.Type != binder.Type)
                            ret = new DynamicMetaObject(
                                Expression.Convert(ret.Expression, binder.Type),
                                ret.Restrictions
                            );
                        return ret;
                    }
                }

                if (type == typeof(bool) && binder.Explicit)
                    throw Assert.Unreachable;

                DynamicMetaObject result;
                if (_type.HandleConvert(binder, this, out result))
                    return result;

                var fallback = binder.FallbackConvert(this, result);
                //BindingRestrictions restrictions = fallback.Restrictions.Merge(BindingRestrictions.GetTypeRestriction(Expression, LimitType));
                //foreach (var arg in indexes)
                //    restrictions = restrictions.Merge(BindingRestrictions.GetTypeRestriction(arg.Expression, arg.LimitType));

                //return new DynamicMetaObject(
                //    AssertImplemented(
                //        Expression.Call(
                //            Expression.Constant(_type, typeof(TotemType)),
                //            TotemType.GetMissingIndexInfo,
                //            Expression,
                //            Expression.NewArrayInit(
                //                typeof(object),
                //                ArrayUtils.ConvertAll(indexes, i => i.Expression)
                //            )
                //        ),
                //        fallback.Expression
                //    ),
                //    restrictions
                //);
                return fallback;
            }
开发者ID:Alxandr,项目名称:IronTotem,代码行数:50,代码来源:TotemType.cs

示例5: BindConvert

 public override DynamicMetaObject BindConvert(ConvertBinder binder)
 {
     Fallback fallback = null;
     if (!this.IsOverridden("TryConvert"))
     {
         return base.BindConvert(binder);
     }
     if (fallback == null)
     {
         fallback = e => binder.FallbackConvert(this, e);
     }
     return this.CallMethodWithResult("TryConvert", binder, NoArgs, fallback);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:DynamicObject.cs

示例6: BindConvert

 public override DynamicMetaObject BindConvert(ConvertBinder/*!*/ conversion) {
     if (conversion.Type.IsSubclassOf(typeof(Delegate))) {
         return MakeDelegateTarget(conversion, conversion.Type, Restrict(typeof(BuiltinFunction)));
     }
     return conversion.FallbackConvert(this);
 }
开发者ID:octavioh,项目名称:ironruby,代码行数:6,代码来源:MetaBuiltinFunction.cs

示例7: BindConvert

 public override DynamicMetaObject BindConvert( ConvertBinder binder )
 {
     return binder.FallbackConvert( _baseMetaObject, AddTypeRestrictions( _metaObject.BindConvert( binder ) ) );
 }
开发者ID:allenwgreaves,项目名称:prototype.ps,代码行数:4,代码来源:Prototype.cs


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