Hi,
The subject says it all. Is there an equivalent, in VB.NET, for the C#
statement Lock(Object){}
Thanks
ThunderMusic 14 8224 http://msdn.microsoft.com/library/de...kStatement.asp
"The lock keyword marks a statement block as a critical section by
obtaining the mutual-exclusion lock for a given object, executing a
statement, and then releasing the lock. This statement takes the
following form:
lock(expression) statement_block
where:
expression
Specifies the object that you want to lock on. expression must be a
reference type."
ThunderMusic wrote: Hi, The subject says it all. Is there an equivalent, in VB.NET, for the C# statement Lock(Object){}
Thanks
ThunderMusic
"ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schrieb: The subject says it all. Is there an equivalent, in VB.NET, for the C# statement Lock(Object){}
'SyncLock'.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
AFAIK this is the "SyncLock" statement...
--
Patrice
"ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> a écrit dans le message de
news:uO**************@TK2MSFTNGP10.phx.gbl... Hi, The subject says it all. Is there an equivalent, in VB.NET, for the C# statement Lock(Object){}
Thanks
ThunderMusic
SyncLock ... End SyncLock
ThunderMusic wrote: Hi, The subject says it all. Is there an equivalent, in VB.NET, for the C# statement Lock(Object){}
Thanks
ThunderMusic
thanks a lot for the quick answer!!
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> a écrit dans le
message de news: uw**************@TK2MSFTNGP09.phx.gbl... "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schrieb: The subject says it all. Is there an equivalent, in VB.NET, for the C# statement Lock(Object){}
'SyncLock'.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Once again the VB.NET designers felt it necessary to use more letter than
necessary in their keywords. :-)
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uw**************@TK2MSFTNGP09.phx.gbl... "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schrieb: The subject says it all. Is there an equivalent, in VB.NET, for the C# statement Lock(Object){}
'SyncLock'.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
"Peter Rilling" <pe***@nospam.rilling.net> schrieb: Once again the VB.NET designers felt it necessary to use more letter than necessary in their keywords. :-)
Not really. 'Lock' is far too generic to be self-descriptive.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Thats a matter of taste. By using longer and almost always more descriptive
keywords and variable names, VB programs tend to require less line by line
documentation. Both languages still need docs on a program's theory of
operations, but VB requires less line by line stuff.
I also program in C++, so I do have the background to compare the BASIC and
C languages and their descendents.
Mike Ober.
"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:OO*************@TK2MSFTNGP11.phx.gbl... Once again the VB.NET designers felt it necessary to use more letter than necessary in their keywords. :-)
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message news:uw**************@TK2MSFTNGP09.phx.gbl... "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> schrieb: The subject says it all. Is there an equivalent, in VB.NET, for the
C# statement Lock(Object){}
'SyncLock'.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Not to mention that "Lock" was a keyword in VB.Classic (and B.A.S.I.C. going
back to the old days) as part of the "Open file For..." as well as a
standalone statement in VB.Classic (Lock #filenum) and a now function in
VB.NET.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:us*************@TK2MSFTNGP10.phx.gbl... "Peter Rilling" <pe***@nospam.rilling.net> schrieb: Once again the VB.NET designers felt it necessary to use more letter than necessary in their keywords. :-)
Not really. 'Lock' is far too generic to be self-descriptive.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Peter, Once again the VB.NET designers felt it necessary to use more letter than necessary in their keywords. :-)
Do you now understand why there is in VBNet less need for XML or other
documentation.
I hate to read those C# programs with for every line of code 5 lines of
documentation.
Cor
Michael D. Ober <obermd.@.alum.mit.edu.nospam> wrote: Thats a matter of taste. By using longer and almost always more descriptive keywords and variable names, VB programs tend to require less line by line documentation. Both languages still need docs on a program's theory of operations, but VB requires less line by line stuff.
If one requires line-by-line documentation in C# for the basics of the
language, the code can't be very good.
I only write documentation inside methods to give a general overview of
what's happening in a section (which often leads to refactoring of that
section into its own method) or if a statement is clear in terms of
what it's doing at a low level, but not in terms of its overall effect.
Neither of these would be reduced by using a more verbose language.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Cor Ligthert [MVP] <no************@planet.nl> wrote: Once again the VB.NET designers felt it necessary to use more letter than necessary in their keywords. :-)
Do you now understand why there is in VBNet less need for XML or other documentation.
Absolutely not. When you're calling a method, you still need to know
what it's going to do, preferrably without having to look at the method
implementation.
I hate to read those C# programs with for every line of code 5 lines of documentation.
So would I - because that's clearly badly written code. See my response
to Mike for more details.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
"Jon Skeet [C# MVP]" <sk***@pobox.com> schrieb: > Once again the VB.NET designers felt it necessary to use more letter > than > necessary in their keywords. :-) Do you now understand why there is in VBNet less need for XML or other documentation.
Absolutely not. When you're calling a method, you still need to know what it's going to do, preferrably without having to look at the method implementation.
I agree with you. XML documentation is especially important when selling
class libraries and writing reusable code.
I hate to read those C# programs with for every line of code 5 lines of documentation.
So would I - because that's clearly badly written code. See my response to Mike for more details.
ACK. However, I still think that 'SyncLock' is more self-descriptive and
thus a better choice than 'lock'.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Herfried K. Wagner [MVP] <hi***************@gmx.at> wrote: So would I - because that's clearly badly written code. See my response to Mike for more details.
ACK. However, I still think that 'SyncLock' is more self-descriptive and thus a better choice than 'lock'.
To be honest, I don't think there's a lot of ambiguity in either case.
One thing I have against "lock" is that it would often be my choice of
name for a variable used for locking purposes.
Then again, I'd prefer it if there were no keyword at all, and "using"
statements were used instead, giving a much more flexible framework.
See http://www.pobox.com/~skeet/csharp/m...e/locking.html for
more...
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ORC |
last post by:
Hi,
Will an exception or a return inside a lock statement block unlock the code
so that other threads will be able to enter the code?
Thanks
Ole
|
by: Jim S |
last post by:
My company's code often includes locks, using statements, and
try/catch blocks and ends up with a lot of brackets. Would it make
sense for C# to allow multiple items in these types of blocks?
...
|
by: Roy Chastain |
last post by:
Question
If control leaves the locked block does the lock get cleared?
Example (simple and bad coding)
lock(obj)
{
// code
return;
}
|
by: Steve |
last post by:
Is there equivalent of sscanf function in .NET?
I need to parse string with network MAC address (For example like
11-22-33-44-55-66) and extract each segment into array of bytes.
Can anyone...
|
by: djc |
last post by:
I got great info on related question previously. This link
<http://www.yoda.arachsys.com/csharp/threads/volatility.shtml> from Brian
Gideon was especially informative.
1) the lock statement does...
|
by: Kurt |
last post by:
Below is a class that can accessed from multiple threads and I want the class to be thread safe. I have a private timer member whose interval can be changed by different threads. Which is the correct...
|
by: Tao |
last post by:
hi.. Group,
is there any lock statement like C# in managed C++?
thanks
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| | |