Re: Should the Dispose( ) method only run when there are no other references to an object?



"Steve Richter" <StephenRichter@xxxxxxxxx> wrote in message
news:1169438284.988182.270380@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
thanks for confirming that. I can accept that I have to program for it.
I am thinking that the absence of reference counting from .NET objects
is a failing of its design.

It's not a failing, the very idea was to get rid of ref counting.

Can I define a ReferenceCountObject class
that is derived from Object. Then base any class of mine that I want to
maintain a reference count in from that class? How would such a class
work to update the reference count when the object is passed by
reference to a method or added to a list?

This is one way you could do it. There would be plenty of other custom
methods you could use also which would all be just that, custom. Generally I
would have thought you'd have 1 thread being the owner of the object and
that thread handles to lifetime of that object. If it's passed the object to
another thread then it would know and not dispose it.

Michael


.



Relevant Pages

  • Re: macros using 2 open documents.
    ... We seem to be failing to communicate. ... relevant to the technical solution you are asking for. ... You previously used Windowsand Windowsto reference two documents. ... >> Windows.Activate and the macro worked fine flipping back and forth. ...
    (microsoft.public.word.vba.general)
  • Re: References for VBA
    ... > for yourself and when you do, it's a failing in the product and/or ... >>> Hi Amy, ... >>> Access, it's the mso constants that aren't defined, so ... ... >> Why would that give a good indication of the reference that was missing? ...
    (microsoft.public.word.vba.userforms)
  • Re: References for VBA
    ... > are pointed out and a failing in Access help (and, even more so, a failing ... Why would that give a good indication of the reference that was missing? ... Where would I find that the mso constants are defined within a specific ...
    (microsoft.public.word.vba.userforms)
  • Re: Should the Dispose( ) method only run when there are no other references to an object?
    ... I am thinking that the absence of reference counting from .NET objects ... It's not a failing, the very idea was to get rid of ref counting. ... another thread then it would know and not dispose it. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Problems with Runtime 2007
    ... Thanks for responding...i think it's the FileSystemObject that is failing as ... Is FileSystemObject or the kill command failing? ... works fine and i have used late binding to avoid outlook reference problems. ... Set objmail = olapp.CreateItem ...
    (microsoft.public.access.modulesdaovba)