[Mono-osx] Proper way to use arrays in MonoMac

flohei flo at rootof.net
Sat Nov 6 10:51:32 EDT 2010


Hi there,

I'm just started working on a project in MonoMac, which is pretty cool so
far. But there're still some things I'm not sure of. For example: How do you
use arrays? Here's what I found out: When I get an NSArray back from a
method I'm calling and I try to get one of the custom objects in that array
I keep getting something like "cannot convert type System.IntPtr to MyType".

NSArray groupArray = (NSArray)groupDictionary.ObjectForKey(key);
MyType myObject = (MyType)groupArray.ValueAt(0);
That's for arrays I get back. But what if I want to create an array on my
own? The implementation of NSArray does not allow me to instantiate it. So
if I got the MonoMac website right, I should use an ordinary array like this

int[] intArray = int[10];
respectively an strongly-typed array which I'm not aware of how to use it in
C#.

So what's the way to go here?

Thanks
–f
-- 
View this message in context: http://mono.1490590.n4.nabble.com/Proper-way-to-use-arrays-in-MonoMac-tp3030049p3030049.html
Sent from the Mono - OSX mailing list archive at Nabble.com.


More information about the Mono-osx mailing list