Re: Should the Dispose( ) method only run when there are no other references to an object?
- From: "Michael C" <nospam@xxxxxxxxxx>
- Date: Mon, 22 Jan 2007 15:25:28 +1100
"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
.
- Follow-Ups:
- References:
- Should the Dispose( ) method only run when there are no other references to an object?
- From: Steve Richter
- Re: Should the Dispose( ) method only run when there are no other references to an object?
- From: Brian Gideon
- Re: Should the Dispose( ) method only run when there are no other references to an object?
- From: Steve Richter
- Should the Dispose( ) method only run when there are no other references to an object?
- Prev by Date: Re: << and >> operators in c#
- Next by Date: Re: << and >> operators in c#
- Previous by thread: Re: Should the Dispose( ) method only run when there are no other references to an object?
- Next by thread: Re: Should the Dispose( ) method only run when there are no other references to an object?
- Index(es):
Relevant Pages
|