[Cocoa-sharp] Patch for NSObject and NSNumber
David Mitchell
dave at fallingcanbedeadly.com
Fri Jul 6 00:05:22 EDT 2007
Could someone review/commit this patch to Subversion (I have no write SVN
access). It accomplishes two things:
1. It addresses what I perceive to be something of a design flaw in
Cocoa# with respect to NSObject (sorry if I'm stepping on anyone's toes,
here). In a nutshell, my gripe is that for any class to be acceptable from
Objective C, it must include a constructor that takes an IntPtr. I
understand that IntPtrs are quite necessary to do most of the Interop with
Objective C, but I don't see why I should still have to be thinking about it
as I build controllers and models. My patch to Object.cs addresses this by
having the default constructor not call into Objective C for an IntPtr (the
first call to NativeObject's accessor will take care of this if it has not
been set by the time it is called), and the method FromIntPtr() has been
modified so that in addition to calling a constructor that takes and IntPtr,
it can also call a default constructor and then set the NativeObject on it.
If you need a code example that shows how this can be useful, I can provide
it.
2. It implements a wrapper for NSNumber. I've found this to be
particularly useful in dealing with KeyValue coding.
Thanks!
--Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/cocoa-sharp/attachments/20070705/5acdede0/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cocoa-sharp-07-05-07.patch
Type: application/octet-stream
Size: 2831 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/cocoa-sharp/attachments/20070705/5acdede0/attachment.obj
More information about the Cocoa-sharp
mailing list