Paul Knopf
Paul Knopf

Reputation: 9776

MonoTouch Point[] to array of NSObject[]

I have a binding the wraps NSArray as an array of NSObject (NSObject[]);

I have to set the property with a list of System.Drawing.Point[].

Unfortunately, I can't create an array of NSObject with items that don't inherit from NSObject.

How do I set this property with an array of System.Drawing.Point? I notice some runtime variables of NSPoint. How do I use that?

Upvotes: 1

Views: 373

Answers (1)

milan.rancic
milan.rancic

Reputation: 219

It is possible. For example:

PointF[] points = new PointF[] { new PointF(), new PointF() };
NSObject[] objects = new NSObject[]{NSObject.FromObject(points[0]), NSObject.FromObject(points[1])};

FromObject method has parameter which is object type, so you can allocate anything.

Upvotes: 1

Related Questions