Re: Null out the current object... possible?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: AC (AC_at_discussions.microsoft.com)
Date: 11/13/04


Date: Sat, 13 Nov 2004 03:45:01 -0800

My specific case is my object is a CustomProperty. When the property is
Deleted, it removes it's record form the database and I wanted to destroy the
object at the same time.

"Richard Blewett [DevelopMentor]" wrote:

> When you say you need to destroy it, what do you actually need to do (I'm asking this because you can't do what you are suggesting in .NET)?
>
> 1. Release the resources used by the Animal?
> 2. Free up the memory consumed by the animal?
> 3. Remove the Animal from a collection?
> 4. Re-initialize the Animal back to its original state?
> 5. Make the Animal's consumer refer to a null reference rather than this Animal instance?
> 6. Something else?
>
> Regards
>
> Richard Blewett - DevelopMentor
> http://www.dotnetconsult.co.uk/weblog
> http://www.dotnetconsult.co.uk
>
> I have the need to destory the current object when a method is called. Such
> as:
>
> public class Animal{
> public string animalType = string.Empty;
> public void Delete(){
> this = null;
> }
> }
>
> When I compile it, it throws an error. Is this not possible? I know the
> user of class Animal can set it to null on his own, but was hoping I could do
> this.
>
> -AC
>
>



Relevant Pages

  • Re: getting rid of the "Issuing rollback()" warning
    ... When a DBI database handle is destroyed, ... The DESTROY method naturally disconnects the database connection. ... including Oracle, will commit. ...
    (perl.dbi.users)
  • Re: slightly off topic - "break" a database
    ... >What you did was not funny. ... much less a friend. ... A database snapshot even on someone's laptop could be for a power ... She could also have used it to gather data or destroy ...
    (comp.databases.oracle.server)
  • RE: Semantics of InactiveDestroy
    ... "InactiveDestroy" attribute on DB handles. ... used to disable the *database engine* related effect of DESTROYing ... in the DESTROY method'. ... shown in the trace log whenever a DBI or handle tracemethod ...
    (perl.dbi.users)
  • Re: slightly off topic - "break" a database
    ... do not allow the structure of the database to be altered or destroyed. ... She could also have used it to gather data or destroy data or even destroy databases. ... It is one thing to fully protect a server in a server room with a ... the need to have an armed guard watch your laptop. ...
    (comp.databases.oracle.server)