Hi,
The subject says it all. Is there an equivalent, in VB.NET, for the C#
statement Lock(Object){}
Thanks
ThunderMusic 14 2635 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: xeqister |
last post by:
Greetings,
We are connecting to a DB2 database residing on an AIX machine via
JDBC.
In order to lock some row of records, we use the "select . . . for
update . . . " Java statement:
In a...
|
by: harborboy76 |
last post by:
Hi all,
First of all, just want to let you know that I'm coming from
Informix background, and we just recently migrated to DB2. It's
been a great new learning experience. For the time being, I...
|
by: Nashat Wanly |
last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaskdr/html/askgui06032003.asp
Don't Lock Type Objects!
Why Lock(typeof(ClassName)) or SyncLock GetType(ClassName) Is Bad
Rico...
|
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: marvind |
last post by:
Hello,
Why doesn't the lock in Class2::Execute protect the critical section:
public Class1
{
...
public DataTable SchemaTable = new DataTable();
}
|
by: Scott Johnson |
last post by:
Hi
I am converting some code from C# to VB.NET and I have come across a command
that I can't find the VB equivalent. The C# command is 'lock' and I think
it is used to lock a data type from...
|
by: Ed L. |
last post by:
I think I'm seeing table-level lock contention in the following function
when I have many different concurrent callers, each with mutually distinct
values for $1. Is there a way to reimplement...
|
by: ThunderMusic |
last post by:
Hi,
The subject says it all. Is there an equivalent, in VB.NET, for the C#
statement Lock(Object){}
Thanks
ThunderMusic
|
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: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
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: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
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...
| | |