本文整理汇总了C#中System.Dynamic.DynamicMetaObject.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# DynamicMetaObject.ToList方法的具体用法?C# DynamicMetaObject.ToList怎么用?C# DynamicMetaObject.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Dynamic.DynamicMetaObject
的用法示例。
在下文中一共展示了DynamicMetaObject.ToList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveOverload
DynamicMetaObject ResolveOverload(DynamicMetaObject target, DynamicMetaObject[] args, MethodInfo[] methods, BindingRestrictions additionalRestrictions = null)
{
OverloadResolver or;
if (target != null)
{
List<DynamicMetaObject> tmp = args.ToList();
tmp.Insert(0, target);
args = tmp.ToArray();
or = this._languageContext.OverloadResolverFactory.CreateOverloadResolver(args, new CallSignature(args.Length), CallTypes.None);
}
else
{
or = this._languageContext.OverloadResolverFactory.CreateOverloadResolver(args, new CallSignature(args.Length), CallTypes.None);
}
BindingTarget bt = or.ResolveOverload(this.Name, methods, NarrowingLevel.None, NarrowingLevel.All);
BindingRestrictions restrictions = bt.RestrictedArguments != null ? bt.RestrictedArguments.GetAllRestrictions() : BindingRestrictions.Empty;
if (!bt.Success)
{
foreach (DynamicMetaObject mo in args)
restrictions = restrictions.Merge(BindingRestrictions.GetTypeRestriction(mo.Expression, mo.GetLimitType()));
return DefaultBinder.MakeError(or.MakeInvalidParametersError(bt), restrictions, typeof(object));
}
if(additionalRestrictions != null)
restrictions = restrictions.Merge(additionalRestrictions);
Expression callExpression = bt.MakeExpression();
if (callExpression.Type == typeof(void))
callExpression = Expression.Block(new[] { callExpression, Expression.Constant(null) });
else if (callExpression.Type != typeof(object))
callExpression = Expression.Convert(callExpression, typeof(object));
return new DynamicMetaObject(callExpression, restrictions);
}