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

kjpou1 kjpou at pt.lu
Sun Nov 7 08:15:40 EST 2010


Hi flohei

Here is what I have been using in a couple of programs:

To create an NSArray of objects:

NSObject[] objs = new NSObject[2]
{NSNumber.FromDouble(0.5),NSNumber.FromDouble(0.2)};
NSArray arr = NSArray.FromNSObjects(objs);

-or-

Skipping the intermediate NSObject[] objs in one line
			
NSArray objArr = NSArray.FromNSObjects(new NSObject[2]
{NSNumber.FromDouble(0.5),NSNumber.FromDouble(0.2)});

Cycling through the NSArray
			
for (uint x = 0; x < objArr.Count; x++)
	Console.WriteLine(new NSNumber(objArr.ValueAt(x)));

Hope that helps you get started.

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


More information about the Mono-osx mailing list