Question about C# collections.

Hi all,

I´m new to unity scripting (c#). I have used C# myself, but I´m a bit lost about what could I use in unity and what I can´t. For example, now I´m porting code from a php module and I want to have something like associative arrays in unity. In c# I used to use IDictionary in the System.Collections.Generics namespace. Is there any prob using this? WIll it be too slow for example for iphone?.

Sorry if this are pretty newbie questions, but after reading some tutorials on the wiki it is not clear to me.

Thanks in advance,
HexDump.

The easiest way would be to try it and see… if it’s too slow you can always reimplement what you need of it.

I would guess that it should be fine, if it’s accesible, though.

I don’t know about too slow, but Unity iPhone doesn’t support generics. You should be fine with the data structures in the normal System.Collections namespace though.

Rune

Hi again,

Thanks for the answers. I will try them and see how they work.

Cheers,
HexDump.

Specifically, you might be interested in Hashtable:
http://www.go-mono.com/docs/monodoc.ashx?tlink=13@ecma%3A196%23Hashtable%2F

Hi!,

Yes Horsman this was the one I decided to use :). Anyway I think a bin tree or something like this would be better in performance terms if it doesn´t change too much, that is my case.

Thanks in advance,
HexDump.