Is there a lock statement in VB.NET?
C#vb.netC# Problem Overview
Does VB.NET have the equivalent of C#'s lock
statement?
C# Solutions
Solution 1 - C#
Yes, the SyncLock statement.
For example:
// C#
lock (someLock)
{
list.Add(someItem);
}
// VB
SyncLock someLock
list.Add(someItem)
End SyncLock
Solution 2 - C#
It is called SyncLock example:
Sub IncrementWebCount()
SyncLock objMyLock
intWebHits += 1
Console.WriteLine(intWebHits)
End SyncLock
End Sub
Solution 3 - C#
Yes, it's called SyncLock