Re: Why exactly is C# better than C++ (was Re: Up to date MFC Book)
"David Ching" <dc@remove-this.dcsoft.com> wrote in message
news:wg%Jg.7369$q63.6461@newssvr13.news.prodigy.com...
"Tamas Demjen" <tdemjen@yahoo.com> wrote in message
news:eG18OjezGHA.2076@TK2MSFTNGP04.phx.gbl...
List<RefClass> list; // doesn't work
List<RefClass^> list;
// compiles, but no deterministic destruction for its members
Oh boy. I had thought that if I implemented both ~Class() and !Class() in
CLI (yes, CLI, not MC++), that I didn't have to worry about anything. It
would just work. If I have to go through my classes and figure out what
are ref objects or not, that kind of is a deal breaker, isn't it? Either
it works 100% without thinking, or it doesn't. Can you verify that it
doesn't?
Upon re-reading what Tamas wrote, it seems you only have to worry about
deterministic finalization of objects stored in .NET collections, like
lists. If that's the case, it isn't as serious a problem as I had thought.
Most objects in collections don't hold resources open using the "Resource
Acquisition is Initialization" which is primarily what I want to use
deterministic finalization for.
Thanks,
David