Click here to Skip to main content
15,907,225 members
Home / Discussions / C#
   

C#

 
GeneralRe: Destructor problem Pin
Nnamdi Onyeyiri27-Aug-02 21:15
Nnamdi Onyeyiri27-Aug-02 21:15 
GeneralRe: Destructor problem Pin
Michael Mac28-Aug-02 0:15
Michael Mac28-Aug-02 0:15 
GeneralRe: Destructor problem Pin
Nnamdi Onyeyiri27-Aug-02 8:49
Nnamdi Onyeyiri27-Aug-02 8:49 
GeneralRe: Destructor problem Pin
David Stone27-Aug-02 11:49
sitebuilderDavid Stone27-Aug-02 11:49 
GeneralRe: Destructor problem Pin
Nnamdi Onyeyiri27-Aug-02 11:51
Nnamdi Onyeyiri27-Aug-02 11:51 
GeneralRe: Destructor problem Pin
Christian Graus27-Aug-02 12:05
protectorChristian Graus27-Aug-02 12:05 
GeneralRe: Destructor problem Pin
leppie27-Aug-02 21:54
leppie27-Aug-02 21:54 
GeneralRe: Destructor problem Pin
Christian Graus28-Aug-02 12:08
protectorChristian Graus28-Aug-02 12:08 
leppie wrote:
Thats sounds like a lot of "extra useless" work though

It *is*, except that there is no deterministic finalisation, therefore you need it if you want destruction to happen when an item goes out of scope, or at any other time you choose.


leppie wrote:
How would disposed be called then, automatically?

No, the point is that the system cannot tell when to call it.


leppie wrote:
If it not auto, then it defeats the point...

Sadly, that *is* the point. There is no mechanism whereby a destructor gets called at any specific time, and so you need to abstract the destruction into a function you *can* call, which is the only reason for IDispose, to formalise what is really both obvious and a little sad.

Having said that, the fact that C# moves towards an idiom where try/catch is used more than in C++, because the API's throw Exceptions rather than return error codes, it's really not that hard to have a finally block that handles the cleanup through IDispose, or otherwise. I was a little sad at first, and it still makes things ugly in some cases, but I tend to think now it's more of a paradigm change than an all out disaster. Not like the fact that const is broken in C#.


Christian

We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )

Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
GeneralClass DLL Pin
Jassim Rahma27-Aug-02 7:29
Jassim Rahma27-Aug-02 7:29 
GeneralRe: Class DLL Pin
Nnamdi Onyeyiri27-Aug-02 8:50
Nnamdi Onyeyiri27-Aug-02 8:50 
GeneralBrowse directory Pin
Mazdak27-Aug-02 6:07
Mazdak27-Aug-02 6:07 
GeneralRe: Browse directory Pin
Sijin27-Aug-02 7:56
Sijin27-Aug-02 7:56 
GeneralRe: Browse directory Pin
Mazdak27-Aug-02 7:59
Mazdak27-Aug-02 7:59 
GeneralReceive and send in two single threads Pin
Rickard Andersson2027-Aug-02 4:23
Rickard Andersson2027-Aug-02 4:23 
GeneralRe: Receive and send in two single threads Pin
Nnamdi Onyeyiri27-Aug-02 4:39
Nnamdi Onyeyiri27-Aug-02 4:39 
GeneralRe: Receive and send in two single threads Pin
Rickard Andersson2027-Aug-02 5:34
Rickard Andersson2027-Aug-02 5:34 
GeneralRe: Receive and send in two single threads Pin
leppie27-Aug-02 5:57
leppie27-Aug-02 5:57 
GeneralRe: Receive and send in two single threads Pin
Rickard Andersson2027-Aug-02 7:09
Rickard Andersson2027-Aug-02 7:09 
GeneralRe: Receive and send in two single threads Pin
James T. Johnson27-Aug-02 6:00
James T. Johnson27-Aug-02 6:00 
GeneralRe: Receive and send in two single threads Pin
Rickard Andersson2027-Aug-02 7:07
Rickard Andersson2027-Aug-02 7:07 
GeneralRe: Receive and send in two single threads Pin
James T. Johnson27-Aug-02 13:12
James T. Johnson27-Aug-02 13:12 
GeneralConverting string to a date Pin
halbichmi27-Aug-02 4:24
halbichmi27-Aug-02 4:24 
GeneralRe: Converting string to a date Pin
Paul Riley27-Aug-02 4:33
Paul Riley27-Aug-02 4:33 
GeneralRe: Converting string to a date Pin
halbichmi27-Aug-02 4:41
halbichmi27-Aug-02 4:41 
GeneralRe: Converting string to a date Pin
Paul Riley27-Aug-02 4:48
Paul Riley27-Aug-02 4:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.