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


C# Proc.Create方法代码示例

本文整理汇总了C#中IronRuby.Builtins.Proc.Create方法的典型用法代码示例。如果您正苦于以下问题:C# Proc.Create方法的具体用法?C# Proc.Create怎么用?C# Proc.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IronRuby.Builtins.Proc的用法示例。


在下文中一共展示了Proc.Create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateNew

        public static Proc/*!*/ CreateNew(CallSiteStorage<Func<CallSite, Proc, Proc, object>>/*!*/ storage,
            RubyClass/*!*/ self, Proc/*!*/ proc) {
            Assert.NotNull(storage, self, proc);

            // an instance of Proc class, the identity is preserved:
            if (self.GetUnderlyingSystemType() == typeof(Proc)) {
                return proc;
            }

            // an instance of a Proc subclass:
            var result = new Proc.Subclass(self, proc);

            var initialize = storage.GetCallSite("initialize", new RubyCallSignature(0, RubyCallFlags.HasImplicitSelf | RubyCallFlags.HasBlock));

            // a call to the initializer with a block:
            object initResult = null;
            do {
                // a new proc is created each iteration (even if a subclass is passed in, the Proc class is created):
                var argProc = proc.Create(proc);

                try {
                    initResult = initialize.Target(initialize, proc, argProc);
                } catch (EvalUnwinder u) {
                    initResult = u.ReturnValue;
                }

                Debug.Assert(proc != argProc, "retry doesn't propagate to the caller");
            } while (RubyOps.IsRetrySingleton(initResult));

            return result;
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:31,代码来源:ProcOps.cs

示例2: CreateNew

        public static Proc/*!*/ CreateNew(RubyClass/*!*/ self, Proc/*!*/ proc) {
            Assert.NotNull(self, proc);

            // an instance of Proc class, the identity is preserved:
            if (self.GetUnderlyingSystemType() == typeof(Proc)) {
                return proc;
            }

            // an instance of a Proc subclass:
            var result = new Proc.Subclass(self, proc);

            // a call to the initializer with a block:
            object initResult = null;
            do {
                // a new proc is created each iteration (even if a subclass is passed in, the Proc class is created):
                var argProc = proc.Create(proc);

                try {
                    initResult = _InitializeSite.Target(_InitializeSite, self.Context, proc, argProc);
                } catch (EvalUnwinder u) {
                    initResult = u.ReturnValue;
                }

                Debug.Assert(proc != argProc, "retry doesn't propagate to the caller");
            } while (RubyOps.IsRetrySingleton(initResult));

            return result;
        }
开发者ID:mscottford,项目名称:ironruby,代码行数:28,代码来源:ProcOps.cs


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