本文整理汇总了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);
}
示例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());
}
示例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);
}
}
示例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());
}
示例5: ExceptionEmpty
public void ExceptionEmpty()
{
var deque = new Deque<int>();
deque.DequeueHead();
}