Ivan, I'm not sure but I've asked the rest of the team and someone will get back to you shortly.
~Jimmy On Jan 11, 2010, at 12:00 AM, "Ivan Porto Carrero" <i...@flanders.co.nz<mailto:i...@flanders.co.nz>> wrote: I specifically wanted to find a counterpart for this C# public class SomeClass { private object _unmanagedResource; public SomeClass(object unmanagedResource){ _unmanagedResource = unmanagedResource; } ~SomeClass(){ _unmanagedResource.Cleanup(); _unmanagedResource = null; } } I was writing about the dispose pattern and wanted to include a full counterpart implementation with a finalizer for unmanaged resources. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: <http://flanders.co.nz> http://flanders.co.nz Twitter: <http://twitter.com/casualjim> http://twitter.com/casualjim Author of IronRuby in Action (<http://manning.com/carrero>http://manning.com/carrero) On Mon, Jan 11, 2010 at 6:12 AM, Sam Clopton <<mailto:li...@ruby-forum.com>li...@ruby-forum.com<mailto:li...@ruby-forum.com>> wrote: Ivan Porto carrero wrote: > Hi > > How do I add a finalizer to a ruby object? > > I've tried using ObjectSpace and define_finalizer. > But the proc never got executed when I called > ObjectSpace.garbage_collect > Calling System::GC.collect had the same outcome > > and implementing a Finalize method doesn't seem to have any effect > either > > class MyClass > > def Finalize > puts "in Finalize" > end > > def finalize > puts "in lower finalize" > end > > end What about using a proc, or block and running finalize after yield or proc.call? -Sam -- Posted via <http://www.ruby-forum.com/> http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list <mailto:Ironruby-core@rubyforge.org>Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org> <http://rubyforge.org/mailman/listinfo/ironruby-core>http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core