W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
下表列出了Queue類的一些常用屬性:
屬性 | 描述 |
---|---|
Count | Gets the number of elements contained in the Queue. 獲取隊(duì)列中包含的元素?cái)?shù)。 |
下表列出了Queue類的一些常用方法:
S.N | 方法名稱和用途 |
---|---|
1 | Public Overridable Sub Clear Removes all elements from the Queue. 從隊(duì)列中刪除所有元素。 |
2 | Public Overridable Function Contains (obj As Object) As Boolean Determines whether an element is in the Queue. 確定元素是否在隊(duì)列中。 |
3 | Public Overridable Function Dequeue As Object Removes and returns the object at the beginning of the Queue. 刪除并返回隊(duì)列開頭的對(duì)象。 |
4 | Public Overridable Sub Enqueue (obj As Object) Adds an object to the end of the Queue. 將對(duì)象添加到隊(duì)列的末尾。 |
5 | Public Overridable Function ToArray As Object() Copies the Queue to a new array. 將隊(duì)列復(fù)制到新數(shù)組。 |
6 | Public Overridable Sub TrimToSize Sets the capacity to the actual number of elements in the Queue. 將容量設(shè)置為隊(duì)列中實(shí)際的元素?cái)?shù)。 |
Module collections Sub Main() Dim q As Queue = New Queue() q.Enqueue("A") q.Enqueue("M") q.Enqueue("G") q.Enqueue("W") Console.WriteLine("Current queue: ") Dim c As Char For Each c In q Console.Write(c + " ") Next c Console.WriteLine() q.Enqueue("V") q.Enqueue("H") Console.WriteLine("Current queue: ") For Each c In q Console.Write(c + " ") Next c Console.WriteLine() Console.WriteLine("Removing some values ") Dim ch As Char ch = q.Dequeue() Console.WriteLine("The removed value: {0}", ch) ch = q.Dequeue() Console.WriteLine("The removed value: {0}", ch) Console.ReadKey() End Sub End Module
Current queue: A M G W Current queue: A M G W V H Removing some values The removed value: A The removed value: M
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: