• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Loop类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Loop的典型用法代码示例。如果您正苦于以下问题:C# Loop类的具体用法?C# Loop怎么用?C# Loop使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Loop类属于命名空间,在下文中一共展示了Loop类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: EdiMapping

 private EdiMapping(XDocument xml)
 {
     if (xml.Root == null)
         throw new Exception("XML is missing a root element.");
     Errors = new List<string>();
     _root = ReadLoop(xml.Root);
 }
开发者ID:inPulseWorks,项目名称:editools,代码行数:7,代码来源:EdiMapping.cs


示例2: Compile

        public override void Compile(ByteCode bc)
        {
            var L = new Loop
            {
                Scope = m_StackFrame
            };

            bc.PushSourceRef(m_Repeat);

            bc.LoopTracker.Loops.Push(L);

            var start = bc.GetJumpPointForNextInstruction();

            bc.Emit_Enter(m_StackFrame);
            m_Block.Compile(bc);

            bc.PopSourceRef();
            bc.PushSourceRef(m_Until);
            bc.Emit_Debug("..end");

            m_Condition.Compile(bc);
            bc.Emit_Leave(m_StackFrame);
            bc.Emit_Jump(OpCode.Jf, start);

            bc.LoopTracker.Loops.Pop();

            var exitpoint = bc.GetJumpPointForNextInstruction();

            foreach (var i in L.BreakJumps)
                i.NumVal = exitpoint;

            bc.PopSourceRef();
        }
开发者ID:eddy5641,项目名称:moonsharp,代码行数:33,代码来源:RepeatStatement.cs


示例3: BlockingPipeListener

		BlockingPipeListener(Loop loop)
			: base(loop)
		{
			PipeListener = new PipeListener(loop);
			Listener = PipeListener as Listener;
			Handle = PipeListener;
		}
开发者ID:txdv,项目名称:LibuvSharp.Blocking,代码行数:7,代码来源:BlockingPipeListener.cs


示例4: Dispose_should_throw_if_child_loops_not_disposed

 public void Dispose_should_throw_if_child_loops_not_disposed()
 {
     using (var loop = new Loop(Times.Once()))
     {
         loop.CreateLoop(Times.Exactly(2));
     }
 }
开发者ID:kellyselden,项目名称:Moq-Sequences,代码行数:7,代码来源:StepTest.cs


示例5: PrepareWatcher

        public PrepareWatcher(Loop loop, Action<PrepareWatcher, EventTypes> callback)
            : base(loop)
        {
            this.callback = callback;

            watcher_ptr = manos_prepare_watcher_create (unmanaged_callback, GCHandle.ToIntPtr (gc_handle));
        }
开发者ID:vbatz258,项目名称:manos,代码行数:7,代码来源:PrepareWatcher.cs


示例6: Routine

    public IEnumerator Routine(Loop loop,float loopTime)
    {
        if (loop.actionDictionary.Count > 0)
        {
            List<Action> actionList = new List<Action>();
            actionList.AddRange(loop.actionDictionary.Values);

            while (runningLoop)
            {

                foreach (Action action in actionList)
                switch (action.actionType)
                {
                    case Action.ActionTypes.Move:

                        Move move = (Move)action;
                        move.ExecuteAction(this.gameObject);
                        break;

                    default:

                        CodeInputHandler.abortPlay("type failed ! check your action type  - 66 action.cs ");
                            runningLoop = false;
                        break;

                }
                yield return new WaitForSeconds(loopTime);
            }
        }
        else
        {
            yield return new WaitForSeconds(loopTime);
        }
    }
开发者ID:weawesomeyo,项目名称:GEJ,代码行数:34,代码来源:SingleObject.cs


示例7: BlockingTcpListener

		BlockingTcpListener(Loop loop)
			: base(loop)
		{
			TcpListener = new TcpListener(loop);
			Listener = TcpListener as Listener;
			Handle = TcpListener;
		}
开发者ID:txdv,项目名称:LibuvSharp.Blocking,代码行数:7,代码来源:BlockingTcpListener.cs


示例8: Dispose_should_do_nothing_if_called_multiple_times

 public void Dispose_should_do_nothing_if_called_multiple_times()
 {
     using (var loop = new Loop(Times.Once()))
     {
         loop.Dispose();
         loop.Dispose();
     }
 }
开发者ID:kellyselden,项目名称:Moq-Sequences,代码行数:8,代码来源:LoopTest.cs


示例9: A_new_step_should_be_added_directly_if_it_contains_no_child_loops

        public void A_new_step_should_be_added_directly_if_it_contains_no_child_loops()
        {
            using (var loop = new Loop(Times.Once()))
            {
                var step = loop.CreateStep("", Times.Once());

                Assert.That(loop.Steps.Contains(step));
            }
        }
开发者ID:kellyselden,项目名称:Moq-Sequences,代码行数:9,代码来源:LoopTest.cs


示例10: MicroThread

		public MicroThread(Loop loop, Action callback)
		{
			Loop = loop;

			State = MicroThreadState.NotStarted;
			Loop.GetMicroThreadCollection().Add(this);

			cb = callback;
		}
开发者ID:txdv,项目名称:LibuvSharp.Blocking,代码行数:9,代码来源:MicroThread.cs


示例11: FlatLoop

        public FlatLoop(Loop sourceLoop, FlatFace flatFace)
        {
            this.sourceLoop = sourceLoop;
            this.flatFace = flatFace;

            fins = new List<FlatFin>();
            foreach (Fin fin in sourceLoop.Fins)
                fins.Add(new FlatFin(this, fin));
        }
开发者ID:bcourter,项目名称:SpaceClaim-AddIns,代码行数:9,代码来源:FlatLoop.cs


示例12: A_new_loop_should_be_added_directly_if_it_contains_no_child_loops

 public void A_new_loop_should_be_added_directly_if_it_contains_no_child_loops()
 {
     using (var loop = new Loop(Times.Once()))
     {
         using (var child = loop.CreateLoop(Times.Once()))
         {
             Assert.That(loop.Steps.Contains(child));
         }
     }
 }
开发者ID:kellyselden,项目名称:Moq-Sequences,代码行数:10,代码来源:LoopTest.cs


示例13: Compute

 public static void Compute(Loop loop, string file)
 {
     var @in = new UVFileStream(loop);
     @in.Open(file, UVFileAccess.Read, (ex) => {
         HashStream.ComputeString(SHA1Managed.Create(), @in, (str) => {
             Console.WriteLine ("{0} {1}", str, file);
         });
         @in.Resume();
     });
 }
开发者ID:oskarwkarlsson,项目名称:LibuvSharp,代码行数:10,代码来源:HashStream.cs


示例14: InvalidRange

        public void InvalidRange()
        {
            var stringlit = new StringLiteral("foo", 0);
            var range = new Range(stringlit, stringlit, 0);
            var variabledecl = new VariableDeclaration("foo", "int", 0);
            var variable = new VariableReference("foo", 0);
            var loop = new Loop(variable, range, new List<Statement>(), 0);
            statementlist.Add(variabledecl);
            statementlist.Add(loop);
            var parsetree = new Program(statementlist);

            Assert.Throws<SemanticError>(() => symbolTableBuilder.BuildSymbolTableAndTypeCheck(parsetree));
        }
开发者ID:Lateks,项目名称:Mini-PL-Interpreter,代码行数:13,代码来源:SemanticAnalysisTest.cs


示例15: visit

            public void visit(Loop node)
            {
                if (symboltable.resolve(node.VarName).Type != "int")
                    throw new SemanticError("Loop variable " + node.VarName +
                        " on row " + node.Row + " is not an int.");

                for (int i = 0; i < 2; i++)
                { // Check twice to prevent variable declarations inside the loop body
                    // (would cause problems because of singular scope).
                    foreach (Statement statement in node.LoopBody)
                        statement.accept(this);
                }
            }
开发者ID:Lateks,项目名称:Mini-PL-Interpreter,代码行数:13,代码来源:SemanticAnalysis.cs


示例16: Driver

        //------------------------------------------------------------------
        protected Driver(Car car)
            : base(car)
        {
            Loop = new Loop();
            Sequence = new Sequence();
            AddInLoop (Sequence);

            Car = car;

            Velocity = Car.Lane.Velocity;
            ChangeLaneSpeed = 1;
            SafeZone = new SafeZone (this, 1);
            Primary = Direction.Left;
        }
开发者ID:CompleteBrains,项目名称:Escape,代码行数:15,代码来源:Driver.cs


示例17: NonIntegerLoopVariable

        public void NonIntegerLoopVariable(string type)
        {
            var variabledecl = new VariableDeclaration("foo", type, 0);
            statementlist.Add(variabledecl);
            var variable = new VariableReference("foo", 0);
            var integer = new IntegerLiteral("5", 0);
            var range = new Range(integer, integer, 0);
            var variabledecl2 = new VariableDeclaration("bar", "int", 0);
            var loopbody = new List<Statement>();
            loopbody.Add(variabledecl2);
            var loop = new Loop(variable, range, loopbody, 0);
            statementlist.Add(loop);
            var parsetree = new Program(statementlist);

            Assert.Throws<SemanticError>(() => symbolTableBuilder.BuildSymbolTableAndTypeCheck(parsetree));
        }
开发者ID:Lateks,项目名称:Mini-PL-Interpreter,代码行数:16,代码来源:SemanticAnalysisTest.cs


示例18: Create

 public static Task Create(Loop loop, string name, int mode)
 {
     var tcs = new TaskCompletionSource<object>();
     try {
         UVDirectory.Create(loop, name, mode, (e) => {
             if (e == null) {
                 tcs.SetResult(null);
             } else {
                 tcs.SetException(e);
             }
         });
     } catch (Exception e) {
         tcs.SetException(e);
     }
     return tcs.Task;
 }
开发者ID:oskarwkarlsson,项目名称:LibuvSharp,代码行数:16,代码来源:UVDirectoryAsync.cs


示例19: Delete

 public static Task Delete(Loop loop, string path)
 {
     var tcs = new TaskCompletionSource<object>();
     try {
         UVDirectory.Delete(loop, path, (e) => {
             if (e == null) {
                 tcs.SetResult(null);
             } else {
                 tcs.SetException(e);
             }
         });
     } catch (Exception e) {
         tcs.SetException(e);
     }
     return tcs.Task;
 }
开发者ID:oskarwkarlsson,项目名称:LibuvSharp,代码行数:16,代码来源:UVDirectoryAsync.cs


示例20: Compile

		public override void Compile(ByteCode bc)
		{
			bc.PushSourceRef(m_RefFor);

			Loop L = new Loop()
			{
				Scope = m_StackFrame
			};

			bc.LoopTracker.Loops.Push(L);

			m_End.Compile(bc);
			bc.Emit_ToNum(3);
			m_Step.Compile(bc);
			bc.Emit_ToNum(2);
			m_Start.Compile(bc);
			bc.Emit_ToNum(1);

			int start = bc.GetJumpPointForNextInstruction();
			var jumpend = bc.Emit_Jump(OpCode.JFor, -1);
			bc.Emit_Enter(m_StackFrame);
			//bc.Emit_SymStorN(m_VarName);

			bc.Emit_Store(m_VarName, 0, 0);

			m_InnerBlock.Compile(bc);

			bc.PopSourceRef();
			bc.PushSourceRef(m_RefEnd);

			bc.Emit_Debug("..end");
			bc.Emit_Leave(m_StackFrame);
			bc.Emit_Incr(1);
			bc.Emit_Jump(OpCode.Jump, start);

			bc.LoopTracker.Loops.Pop();

			int exitpoint = bc.GetJumpPointForNextInstruction();

			foreach (Instruction i in L.BreakJumps)
				i.NumVal = exitpoint;

			jumpend.NumVal = exitpoint;
			bc.Emit_Pop(3);

			bc.PopSourceRef();
		}
开发者ID:eddy5641,项目名称:LuaSharp,代码行数:47,代码来源:ForLoopStatement.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LoopType类代码示例发布时间:2022-05-24
下一篇:
C# LookupResultKind类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap