Destructors in ASPX pages

Results 1 to 2 of 2

Thread: Destructors in ASPX pages

  1. #1
    Join Date
    Dec 1969

    Default Destructors in ASPX pages

    Does anyone know if a class&#039;s destructor gets called in an ASPX page?<BR><BR>I&#039;m not talking about Server Controls. Suppose I write a class that does not derive from anything. I compile it to a DLL and reference it my ASPX page using the &#060;%@ Import... %&#062; Page directive.<BR><BR>If I create a new instance of my class, will it&#039;s destructor get called? Because in my tests, it does not appear that it does. However, if I create an instance of the class in a console app, the destructor does in fact get called.<BR><BR>Any thoughts?<BR>-Steve<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Destructors in ASPX pages

    In any senario, web, console or otherwise, you&#039;re likely to see varying behaviours, because .Net doesn&#039;t support deterministic finalization. A interesting look at how the CLR handles clean-up can be found in the first chunk of this article:<BR><BR><BR><BR>The answer to your specific question, for *any* .Net application is summed up by this bullet point: <BR>(A Finalize() method: ) Is not guaranteed to be called in any order, or at a predictable time<BR><BR>Regards, <BR><BR>Xander<BR><BR><BR>

Posting Permissions

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