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


C# Deque.DequeueHead方法代码示例

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


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

示例1: TestIfSame

        internal static void TestIfSame(Deque<int> deque, Deque<int> newDeque)
        {
            while (deque.Count > 0)
            {
                Assert.AreEqual(deque.DequeueHead(), newDeque.DequeueHead());
            }

            Assert.AreEqual(newDeque.Count, 0);
        }
开发者ID:havok,项目名称:ngenerics,代码行数:9,代码来源:DequeTest.cs

示例2: UndoGroup

        /// <summary>
        /// Initializes a new instance of the <see cref="UndoGroup"/> class.
        /// </summary>
        /// <param name="undoStack">The stack of undo operations.</param>
        /// <param name="numberOfOperations">The number of operations to combine.</param>
        /// <param name="description">The description of the operation.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="undoStack"/> is <see langword="null"/>.
        /// </exception>
        public UndoGroup(Deque<IUndoableOperation> undoStack, int numberOfOperations, object description)
        {
            if (undoStack == null)
            throw new ArgumentNullException("undoStack");

              Description = description;

              Debug.Assert(numberOfOperations > 0, "numberOfOperations should be greater than 0.");
              if (numberOfOperations > undoStack.Count)
            numberOfOperations = undoStack.Count;

              for (int i = 0; i < numberOfOperations; ++i)
            _undoList.Add(undoStack.DequeueHead());
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:23,代码来源:UndoGroup.cs

示例3: Simple

        public void Simple()
        {
            var deque = new Deque<int>();
            Assert.AreEqual(deque.Count, 0);
            Assert.IsTrue(deque.IsEmpty);

            var stack = new Stack<int>();

            for (var i = 0; i < 3; i++)
            {
                stack.Push(i * 4);
            }

            deque = new Deque<int>(stack);

            for (var i = 2; i >= 0; i--)
            {
                Assert.AreEqual(deque.DequeueHead(), i * 4);
            }
        }
开发者ID:GTuritto,项目名称:ngenerics,代码行数:20,代码来源:Contruction.cs

示例4: DequeueHeadExample

        public void DequeueHeadExample()
        {
            var deque = new Deque<string>();
            deque.EnqueueHead("dog");
            deque.EnqueueHead("canary");
            deque.EnqueueHead("cat");

            // DequeueHead gives us "cat"
            Assert.AreEqual("cat", deque.DequeueHead());

            // DequeueHead gives us "canary"
            Assert.AreEqual("canary", deque.DequeueHead());

            // DequeueHead gives us "dog"
            Assert.AreEqual("dog", deque.DequeueHead());
        }
开发者ID:GTuritto,项目名称:ngenerics,代码行数:16,代码来源:DequeExamples.cs

示例5: ExceptionEmpty

 public void ExceptionEmpty()
 {
     var deque = new Deque<int>();
     deque.DequeueHead();
 }
开发者ID:GTuritto,项目名称:ngenerics,代码行数:5,代码来源:DequeueHead.cs


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