|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Lock statement in C#, Is there an equivalent in VB.NET?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: 'SyncLock'.> The subject says it all. Is there an equivalent, in VB.NET, for the C# > statement Lock(Object){} -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> thanks a lot for the quick answer!!
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> a écrit dans le message de news: uwoo0W0KGHA.3***@TK2MSFTNGP09.phx.gbl...Show quoteHide quote > "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. :-) Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:uwoo0W0KGHA.3492@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" <peter@nospam.rilling.net> schrieb: Not really. 'Lock' is far too generic to be self-descriptive.> Once again the VB.NET designers felt it necessary to use more letter than > necessary in their keywords. :-) -- 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. Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:us0rzi0KGHA.952@TK2MSFTNGP10.phx.gbl... > "Peter Rilling" <peter@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. Show quoteHide quote "Peter Rilling" <peter@nospam.rilling.net> wrote in message news:OOCbwe0KGHA.668@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]" <hirf-spam-me-here@gmx.at> wrote in message > news:uwoo0W0KGHA.3492@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/> > > > Michael D. Ober <ober***@.alum.mit.edu.nospam> wrote:
> Thats a matter of taste. By using longer and almost always more descriptive If one requires line-by-line documentation in C# for the basics of the > 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. 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 Peter,
> Once again the VB.NET designers felt it necessary to use more letter than Do you now understand why there is in VBNet less need for XML or other > necessary in their keywords. :-) > documentation. I hate to read those C# programs with for every line of code 5 lines of documentation. Cor Cor Ligthert [MVP] <notmyfirstn***@planet.nl> wrote:
> > Once again the VB.NET designers felt it necessary to use more letter than Absolutely not. When you're calling a method, you still need to know > > necessary in their keywords. :-) > Do you now understand why there is in VBNet less need for XML or other > documentation. 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 So would I - because that's clearly badly written code. See my response > documentation. 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: I agree with you. XML documentation is especially important when selling >> > 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. class libraries and writing reusable code. >> I hate to read those C# programs with for every line of code 5 lines of ACK. However, I still think that 'SyncLock' is more self-descriptive and >> documentation. > > So would I - because that's clearly badly written code. See my response > to Mike for more details. 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] <hirf-spam-me-here@gmx.at> wrote:
> > So would I - because that's clearly badly written code. See my response To be honest, I don't think there's a lot of ambiguity in either case. > > to Mike for more details. > > ACK. However, I still think that 'SyncLock' is more self-descriptive and > thus a better choice than 'lock'. 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/miscutil/usage/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 AFAIK this is the "SyncLock" statement...
-- Show quoteHide quotePatrice "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> a écrit dans le message de news:uOyxyU0KGHA.3732@TK2MSFTNGP10.phx.gbl... > Hi, > The subject says it all. Is there an equivalent, in VB.NET, for the C# > statement Lock(Object){} > > Thanks > > ThunderMusic > >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfLockStatement.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: Show quoteHide quote > 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: Show quoteHide quote > Hi, > The subject says it all. Is there an equivalent, in VB.NET, for the C# > statement Lock(Object){} > > Thanks > > ThunderMusic > >
For each
Windows Shell Integration: how? Visual Basic 2005 CreateFile Outlook Add-In: msoControlEdit: Textbox loses text when losing focus VB.NET - How do I set and keep data in the clipboard? File is busy convert text to access mdb Structured files in VS 2005 Concatenation - String.Concat Dynamic Insert Statment |
|||||||||||||||||||||||