本文整理汇总了VB.NET中System.Collections.Queue.IsSynchronized属性的典型用法代码示例。如果您正苦于以下问题:VB.NET Queue.IsSynchronized属性的具体用法?VB.NET Queue.IsSynchronized怎么用?VB.NET Queue.IsSynchronized使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Collections.Queue
的用法示例。
在下文中一共展示了Queue.IsSynchronized属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Queue
Dim myCollection As New Queue()
SyncLock myCollection.SyncRoot
For Each item In myCollection
' Insert your code here.
Next item
End SyncLock
示例2: Main
' 导入命名空间
Imports System.Collections
Public Class SamplesQueue
Public Shared Sub Main()
' Creates and initializes a new Queue.
Dim myQ As New Queue()
myQ.Enqueue("The")
myQ.Enqueue("quick")
myQ.Enqueue("brown")
myQ.Enqueue("fox")
' Creates a synchronized wrapper around the Queue.
Dim mySyncdQ As Queue = Queue.Synchronized(myQ)
' Displays the sychronization status of both Queues.
Dim msg As String
If myQ.IsSynchronized Then
msg = "synchronized"
Else
msg = "not synchronized"
End If
Console.WriteLine("myQ is {0}.", msg)
If mySyncdQ.IsSynchronized Then
msg = "synchronized"
Else
msg = "not synchronized"
End If
Console.WriteLine("mySyncdQ is {0}.", msg)
End Sub
End Class
输出:
myQ is not synchronized. mySyncdQ is synchronized.