Results 1 to 4 of 4

Thread: [2.0] Self-destructing class?

  1. #1

    Thread Starter
    Member MasterEvilAce's Avatar
    Join Date
    Jul 2002
    Posts
    60

    Exclamation [2.0] Self-destructing class?

    Is it possible for a class to essentially set itself to null? I need someway to run a function on a class and have it terminate right after.

    Running into infinite loop problem, and I figured out why.. i need to destroy the class when i'm done with it.

    is it possible?

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: [2.0] Self-destructing class?

    Check out the IDispose interface. It provides a method that you can implement in order to cleanly reclaim all resources used by a class instance. Also see "Destructors" in MSDN.
    I don't live here any more.

  3. #3
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: [2.0] Self-destructing class?

    Just set it to null when you're done with it?
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  4. #4
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: [2.0] Self-destructing class?

    Quote Originally Posted by MasterEvilAce
    Is it possible for a class to essentially set itself to null? I need someway to run a function on a class and have it terminate right after.

    Running into infinite loop problem, and I figured out why.. i need to destroy the class when i'm done with it.

    is it possible?
    Implement IDisposable interface and use your class with "using" keyword
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width