- Home /
javascript to C#, var foo : Array = new Array();
I just recently started learning C# and im following an inventory tutorial that is scripted in js. I dont understand how I would convert these following statements to work in C#.
private var flagAvailable : Array; flagAvailable = new Array(); flagAvailable.Push(true);
I did some reading and learned that Array in js is an array of objects, and you can use different types in it,, so I thought I can just make an array of objects like "Object[] flagAvailable = ...". What does that last statement mean, can I use a stack?
Answer by Eric5h5 · Feb 09, 2014 at 12:50 AM
You would use a generic List. (Which is, by the way, what should be used in JS as well. There's no reason for anyone to use the Array class.) In this case it looks like it should be List. Push is like Add.