本文整理汇总了C#中System.Dynamic.BindingRestrictions.ToExpression方法的典型用法代码示例。如果您正苦于以下问题:C# BindingRestrictions.ToExpression方法的具体用法?C# BindingRestrictions.ToExpression怎么用?C# BindingRestrictions.ToExpression使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Dynamic.BindingRestrictions
的用法示例。
在下文中一共展示了BindingRestrictions.ToExpression方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddRestriction
public void AddRestriction(BindingRestrictions/*!*/ restriction) {
if (_treatRestrictionsAsConditions) {
AddCondition(restriction.ToExpression());
} else {
Add(restriction);
}
}
示例2: DumpRule
internal static void DumpRule(CallSiteBinder/*!*/ binder, BindingRestrictions/*!*/ restrictions, Expression/*!*/ expr) {
#if DEBUG && !SILVERLIGHT
if (RubyOptions.ShowRules) {
var oldColor = Console.ForegroundColor;
try {
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("Rule #{0}: {1}", Interlocked.Increment(ref _ruleCounter), binder);
Console.ForegroundColor = ConsoleColor.DarkGray;
if (!_DumpingExpression) {
var d = (restrictions != BindingRestrictions.Empty) ? Expression.IfThen(restrictions.ToExpression(), expr) : expr;
_DumpingExpression = true;
#if CLR2
d.DumpExpression(Console.Out);
#else
try {
if (_dumpViewMethod == null) {
_dumpViewMethod = typeof(Expression).GetMethod("get_DebugView", BindingFlags.NonPublic | BindingFlags.Instance);
}
Console.WriteLine(_dumpViewMethod.Invoke(d, ArrayUtils.EmptyObjects));
Console.WriteLine();
} catch {
// nop
}
#endif
}
} finally {
_DumpingExpression = false;
Console.ForegroundColor = oldColor;
}
}
#endif
}
示例3: DumpRule
internal static void DumpRule(DynamicMetaObjectBinder/*!*/ action, BindingRestrictions/*!*/ restrictions, Expression/*!*/ expr) {
#if DEBUG && !SILVERLIGHT && CLR2
if (RubyOptions.ShowRules) {
var oldColor = Console.ForegroundColor;
try {
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("Rule #{0}: {1}", Interlocked.Increment(ref _ruleCounter), action);
Console.ForegroundColor = ConsoleColor.DarkGray;
if (!_DumpingExpression) {
var d = (restrictions != BindingRestrictions.Empty) ? Expression.IfThen(restrictions.ToExpression(), expr) : expr;
_DumpingExpression = true;
d.DumpExpression(Console.Out);
Console.WriteLine();
}
} finally {
_DumpingExpression = false;
Console.ForegroundColor = oldColor;
}
}
#endif
}
示例4: GetMetaObjectRule
private Expression GetMetaObjectRule(Expression bindingExpression, BindingRestrictions bindingRestrictions, LabelTarget @return) {
Expression body = AddReturn(bindingExpression, @return);
if (bindingRestrictions != BindingRestrictions.Empty) {
// add the test only if we have one
body = Expression.Condition(
bindingRestrictions.ToExpression(),
body,
Expression.Empty()
);
}
return body;
}