x


List<> class in iOS (C#)

Is it possible to use the List<> class in iOS?

What I want to do is have a List that gameObjects are added to and removed from at runtime.

Afaik such a thing can only be done through Lists.

If the use of Lists is not possible in iOS, how would I do such a thing?

With ArrayLists maybe? I've read in more than one places that they should be avoided.

more ▼

asked Jan 18 '11 at 10:24 PM

schwertfisch gravatar image

schwertfisch
370 53 57 68

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You can use List just fine on iOS, in both c# and js.

You need using System.Collections.Generic; for c# and import System.Collections.Generic; for js, at the top of the file.

For js, you'll need to use List. instead of List like c#

more ▼

answered Jan 18 '11 at 10:28 PM

Mike 3 gravatar image

Mike 3
30.5k 10 65 253

Thanks Mike. I've read that Generics are not supported at all on iPhone, because it runs on an earlier version of Mono. Is this info outdated? You're saying that I can create a List from inside a js?

Jan 18 '11 at 10:32 PM schwertfisch
Jan 18 '11 at 10:36 PM schwertfisch

That was from 2009, we've come a long way since unity iphone 1.5 or so - can use list with both c# (since, uh, unity iphone 1.6?) and js (since 3.0)

Jan 18 '11 at 11:17 PM Mike 3

Thank you :)

Jan 18 '11 at 11:17 PM schwertfisch
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1969
x356
x72
x37

asked: Jan 18 '11 at 10:24 PM

Seen: 7509 times

Last Updated: Jan 18 '11 at 10:24 PM