Re: Destroying objects.

Tech-Archive recommends: Fix windows errors by optimizing your registry



I want to set all references to an object to Nothing in one statement.
Instead of setting X references to Nothing, I would like to call one
statement with one of the X references, setting them all to Nothing.

I'm not interested in when the object is destroyed. As long as all the
references are Nothing so the garbage collector knows it's good to go.



"Brian Gideon" <briangideon@xxxxxxxxx> wrote in message
news:1140709793.609331.257730@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
No. That's not possible. You have very little control over when an
object is actually destroyed. That's the job of the garbage collector.
What you do have complete control over is how many references there
are to an object.

If you're wanting deterministric finalization then use the IDisposable
interface and adhere to the associated design pattern.

If you're wanting to use advanced techniques for controlling the
lifetime of objects you can use the WeakReference class.

Can you explain a little more about what you're wanting to accomplish?

Brian

qwert wrote:
What I meant was:

Dim objA as New A
Dim objAR As A
objAR = objA
KILL(objA)
If objAR is Nothing then blnGreat = True



.



Relevant Pages

  • Re: Destroying objects.
    ... you sure can control whether your object kills itself (it refuses to ... Instead of setting X references to Nothing, I would like to call one ... If you're wanting deterministric finalization then use the IDisposable ... Dim objAR As A ...
    (microsoft.public.dotnet.languages.vb)
  • Why are so many people using 4.x?
    ... I notice a lot of references to version 4.x. ... Is there any overwhelming reason ... why its use seems to be still popular. ... I'm wanting to set up a server (just ...
    (freebsd-questions)
  • Re: How can I find out where a table is being used in my access db?
    ... Use a utility like Speed Ferret or Find & Replace. ... database, a specific table is used or referenced? ... I'm wanting to clear out a few linked tables, but need to be sure I've ... removed all references to it in things like forms, ...
    (comp.databases.ms-access)
  • How can I find out where a table is being used in my access db?
    ... database, a specific table is used or referenced? ... I'm wanting to clear out a few linked tables, but need to be sure I've ... removed all references to it in things like forms, ... obtain an overall 'snapshot' view of any occurrences of it within the ...
    (comp.databases.ms-access)
  • Re: Destroying objects.
    ... What you do have complete control over is how many references there ... If you're wanting deterministric finalization then use the IDisposable ... Dim objA as New A ... Dim objAR As A ...
    (microsoft.public.dotnet.languages.vb)