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


C# BindingRestrictions.ToExpression方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:madpilot,项目名称:ironruby,代码行数:7,代码来源:MetaObjectBuilder.cs

示例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
        }
开发者ID:atczyc,项目名称:ironruby,代码行数:32,代码来源:RubyBinder.cs

示例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
        }
开发者ID:bclubb,项目名称:ironruby,代码行数:21,代码来源:RubyBinder.cs

示例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;
        }
开发者ID:octavioh,项目名称:ironruby,代码行数:14,代码来源:DynamicMetaObjectBinder.cs


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