當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。