本文整理汇总了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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例7: BindConvert
public override DynamicMetaObject BindConvert( ConvertBinder binder )
{
return binder.FallbackConvert( _baseMetaObject, AddTypeRestrictions( _metaObject.BindConvert( binder ) ) );
}