本文整理汇总了C#中Queue.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# Queue.Remove方法的具体用法?C# Queue.Remove怎么用?C# Queue.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Queue
的用法示例。
在下文中一共展示了Queue.Remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
//Vector v = new Vector();
//Stack v = new Stack();
//LinkedList v = new LinkedList();
Queue v = new Queue();
v.Print();
v.Add(0);
v.Add(1);
v.Add(2);
v.Print();
v.Remove();
v.Print();
v.Remove();
v.Print();
Console.ReadKey();
//v.RemoveFirst();
//v.Print();
//v.RemoveLast();
//v.Print();
//v.RemoveLast();
//v.Add(123);
//v.Print();
//Console.ReadKey();
}
示例2: Main
public static void Main()
{
try {
Queue q1 = new Queue();
Queue q2 = new Queue(3);
q2.Add(4);
q2.Add(5);
Console.WriteLine("The front is now {0}", q2.Head());
q2.Add(6);
Console.WriteLine
("Removing from q2 returns {0}", q2.Remove());
Console.WriteLine("Queue 1 has size {0}", q1.size);
Console.WriteLine("Queue 1 empty? {0}", q1.IsEmpty());
q1.Remove();
Console.WriteLine("Throws exception before we get here");
}catch(Exception e) {
Console.WriteLine(e);
}
}
示例3: TestRemove
public void TestRemove()
{
Queue<String> queue = new Queue<String>();
String first = "one";
String second = "two";
String third = "three";
queue.Enqueue(first);
queue.Enqueue(second);
queue.Enqueue(third);
Assert.AreEqual(true, queue.Contains(first), "Queue did not contain one");
Assert.AreEqual(true, queue.Contains(second), "Queue did not contain two");
Assert.AreEqual(true, queue.Contains(third), "Queue did not contain three");
queue = queue.Remove(first);
Assert.AreEqual(true, queue.Contains(second), "Queue did not contain two");
Assert.AreEqual(true, queue.Contains(third), "Queue did not contain three");
}
示例4: List
public Task<IEnumerable<Uri>> List(Uri path, bool recursive)
{
var items = new List<Uri>();
var queue = new Queue<StorageSimulatorItem>();
var pathInfo = new PathInfo(path);
this.AssertIsValidWabsUri(pathInfo);
StorageSimulatorItem item = this.GetItem(pathInfo, pathInfo.Path.IsNullOrEmpty());
if (item.IsNotNull())
{
queue.Enqueue(item);
while (queue.Count > 0)
{
item = queue.Remove();
queue.AddRange(item.Items.Values);
items.Add(item.Path);
}
}
return Task.FromResult((IEnumerable<Uri>)items);
}