[Mono-osx] MonoMac retain/release
Duane Wandless
duane at wandless.net
Tue Apr 20 13:24:11 EDT 2010
I noticed that retain/release/autorelease our internal methods. I'm not fan
of doing memory management as that takes away time from solving business
needs. Memory management is required with obj-c. And I believe these
should be public.
There are times when an object is passed as an argument into my C# code that
must be retained while the C# code manipulates the object (typically a UI
object)... then release that object when done. The most common usage is the
UI is a delegate for the async C# method. At times the UI object will go
away while the C# code is running its async task. The retain of course
prevents sending a selector to a deallocated object. And there are times
when the UI delegate selector is not invoked so I must be able to release
the UI object from the C# code.
I think one of the fundamental design patterns of MonoTouch and now MonoMac
is that all the code will be written in C#. I do think this assumption is
limiting. Giving the C# code full access to the obj-c objects allows for
truly the best of both worlds. The advantages of the C# language can be
leveraged.. but without limiting the functionality of the various NS classes
within C#.
Again my usage is a native obj-c app for the UI with the business logic in
C#. There are advantages to fully developing within C# MonoMac ... I just
want to push the design so that is not required.
Duane
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20100420/b6373c1e/attachment.html
More information about the Mono-osx
mailing list