Prev: Trouble With Timer
Next: Reading filenames into listbox
From: Cor Ligthert[MVP] on 5 Apr 2010 14:36 The last one or the first one in which he writes that dispose should always be used? The last one is completely different from the first one, and I am writing about his first one, where he tells he is a follower from those who write. They did not put for nothing the Idisposable interface on those classes. It is a contract so it should be used. I was not aware it was your opinion, but glad to know. Maybe you wont believe, but then I don't agree that with you. :-) Cor "Armin Zingler" <az.nospam(a)freenet.de> wrote in message news:#FL2koO1KHA.3412(a)TK2MSFTNGP05.phx.gbl... > Am 05.04.2010 19:18, schrieb Cor Ligthert[MVP]: >>> >> There is a guy here already a while active with the name Armin Zingler, > > I'm not really getting your point mentioning my name, but I was about to > reply to Tom's message and say that I 100% agree with him. > > Despite, let's stay friends. ;) > > -- > Armin
From: Armin Zingler on 5 Apr 2010 14:46 Am 05.04.2010 20:36, schrieb Cor Ligthert[MVP]: > The last one or the first one in which he writes that dispose should always > be used? > > The last one is completely different from the first one, and I am writing > about his first one, where he tells he is a follower from those who write. I read them again but I don't see a contradiction. > They did not put for nothing the Idisposable interface on those classes. It > is a contract so it should be used. yes, should be used. > I was not aware it was your opinion, but glad to know. Maybe you wont > believe, but then I don't agree that with you. > > :-) Maybe it's all a big misunderstanding?! -- Armin
From: Cor Ligthert[MVP] on 6 Apr 2010 02:27 > Maybe it's all a big misunderstanding?! > Yea, good words Armin, I hope so. Cor
From: Gale Green on 6 Apr 2010 17:53
On Mon, 5 Apr 2010 13:15:11 +0200, "Michel Posseth [MCP]" <msdn(a)posseth.com> wrote: Thanks for all that, I shall have a read. I thought it was a fairly straightforward question - I never expected to start a thread going. Oh well. I shall have to get the Balena book - I used his VB book when I first started using VB6. Thanks again. Gale. > >Hmmm ,,,......... > >to the OP > >This is discussed here manny times and it mostly indeed ends in a nothing >saying thread > >http://www.developersdex.com/vb/message.asp?p=1121&r=6705983 >http://bytes.com/topic/visual-basic-net/answers/444984-command-close-vs-command-dispose >http://www.pcreview.co.uk/forums/thread-3854824-3.php >etc etc etc etc etc etc > >http://www.google.nl/#hl=nl&source=hp&q=michel+posseth+dispose&meta=&aq=f&aqi=&aql=&oq=&gs_rfai=&fp=6bc54ad77a0995ae > >Read a few of them and try some of the examples i showed in these threads >and you will notice that your program in some of my described situations can >run forever >while if you follow the Not call dispose camp in the same situation your >progs will crash or degrade overall system performance . > >In case you are wondering ,, yes i am in the call dispose and set to nothing >camp when it actually makes sense to do so , and if you are in doubt just do >it, as it also doesn`t hurt while omitting it wil sure hurt your app. > >As i am a so called "Balena" programmer i follow his design patterns ( wich >actually conform to MS standards as he is also the writer of the MS VB core >reference guides ) described in the Core reference guides of Visual Basic >.Net and in these guide there are examples where a object pointer is set >to nothing and it perfectly makes sence to do so , i have posted this >example several times in the group so with the provided links you should >find it :-) . > >Regards > >Michel Posseth > > > > >"Cor Ligthert[MVP]" <Notmyfirstname(a)planet.nl> schreef in bericht >news:eZVmWzK1KHA.6108(a)TK2MSFTNGP06.phx.gbl... >> Yes I've a point, don't tell Wabash, it seems just to create a Trolling >> thread, this is not the VB6 newsgroup. >> >> You wrote >> > There are objects that implement IDisposable that calling Dispose is not >>> strictly necessary - such as DataSet. These objects actually end up with >>> Dispose because they inherit from component. You may see advice from >>> some >>> that says to avoid calling dispose on these objects. I personally >>> disagree >>> with this advice for a number of reasons and suggest that you make it a >>> strict >>> rule to always call dispose if an object implments IDisposable. >> >> What you wrote, is the same reason why the OP was setting anything to >> Nothing in VB6, somebody had written that and he took the chance that that >> one was right as the best. Now you tell him that he should change that >> practice to use on everything which implements Idisposable the "often" >> senseless dispose method, which only trashes often code in the same way as >> for ever using nothing in VB6. >> >> Form Closing >> label1.dispose >> Label2.dispose >> Label3.dispose >> >> Why don't you write that he should always count like this. >> >> Result = Cint(X.ToString) += 1 because every value type implements even an >> overloaded ToString method, so in your theory it must be used. >> >> All Forms controls and components implement the dispose method inherited >> from the Component class. >> >> You know likewise me that where calling the dispose is needed, this for >> forms and components is done implicit but since version 2005 hidden for >> most beginners in VB.Net in the designer part. >> >> You know also very well, that I am almost the only one who shows in the >> Microsoft Visual Basic forums samples with "using", so don't accuse me >> from things, which you know that aint true. >> >> You know how some regulars in this newsgroup disagree about this with you, >> while other of those agree, no problem but don't see it as a kind of >> evangelism to newbie's, who have set in past everything to nothing, just >> to take no risk and somebody wrote it. >> >> With every object which implements IDisposable, can be used with Using, >> so calling Dispose has no sense anymore, use the better code for that, it >> trashes at least not the code like I showed above. >> >> So where Dispose is needed it is better to use the Using keyword and if >> you don't know, you can also use that using keyword. >> >> Luckily the newer Classes don't implement IDisposale anymore so much >> anymore as in past. >> >> Your message could have also been without that sentence I quoted, it would >> have been a good and correct message. >> >> Now it seems at least to me more a little bit to kick some regulars here >> to the head. >> >> Cor >> >> >> >> "Tom Shelton" <tom_shelton(a)comcastXXXXXXX.net> wrote in message >> news:#A0P71J1KHA.4204(a)TK2MSFTNGP04.phx.gbl... >>> On 2010-04-05, Cor Ligthert[MVP] <Notmyfirstname(a)planet.nl> wrote: >>>> However, in fact Tom does not call the Dispose method in 90% of the >>>> cases, >>>> because he knows that those are implicitly called. >>>> >>>> >>> >>> Cor... It is true that I do not often call the Dispose method directly - >>> I generally enclose disposable objects in a using block, which guarentees >>> the >>> call to dispose. The point that I was makeing is that I generally code >>> to >>> make sure that the object is disposed when I am done with it. I in fact, >>> pointed this out in my post to the OP - the use of using. I am >>> suggesting >>> that the OP does likewise. Making sure a dispose call is made, >>> implicitly via >>> using, or explicitly amounts to about the same thing in my book. >>> >>> I wonder, did you have some valid point to make? >>> >>> -- >>> Tom Shelton >> |