VB.net SyncLock Object
- by Budius
I always seen on SyncLock examples people using
Private Lock1 As New Object ' declaration
SyncLock Lock1 ' usage
but why?
In my specific case I'm locking a Queue to avoid problems on mult-threading Enqueueing and Dequeueing my data.
Can I lock the Queue object itself, like this?
Private cmdQueue As New Queue(Of QueueItem) ' declaration
SyncLock cmdQueue ' usage
Any help appreciated.
Thanks.