|
-
Jan 27th, 2007, 04:23 PM
#1
Thread Starter
Member
[RESOLVED] Lock from C# .Net to VB .Net
Hello ,
can any one help me convert that property to vb .net
Code:
public override int Capacity
{
get
{
lock (_root);
return _collection.Capacity;
}
set
{
lock (_root);
_collection.Capacity = value;
}
}
the proble is , i don't know how i change the lock
VB Code:
Public Overrides Property Capacity As Integer
Get
[COLOR=DarkRed]'lock (_root);[/COLOR]
Return _collection.Capacity
End Get
Set
[COLOR=DarkRed]'lock (_root);[/COLOR]
_collection.Capacity = value
End Set
End Property
thanks in advance
geobest
-
Jan 27th, 2007, 06:25 PM
#2
Re: Lock from C# .Net to VB .Net
SyncLock is the VB equivalent to C#'s "lock".
-
Jan 27th, 2007, 07:20 PM
#3
Re: Lock from C# .Net to VB .Net
By the way, if that C# code was an actual property, then the "lock" is serving no purpose since the lock block has no code.
Usually you would do something like this in C#:
lock (foo)
{
//code regarding 'foo'
}
In your case you have just "lock (_root);", i.e., the empty statement ";" is the only target of the lock. Your code just locks "_root" and then releases the lock.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|