Passing in an array
-
Is there any way to do something like this: StartScreen.mCP.talkTime("#FM", "01", {newINIs, items}); Which is to say passing in an array without actually making the array, or do I need to do it like this: object[] o = new object[] {newINIs, items}; StartScreen.mCP.talkTime("#FM", "01", o); Something like the first way would be better more useful, but Visual Studio doesn't like it, so... - Munty
-
Is there any way to do something like this: StartScreen.mCP.talkTime("#FM", "01", {newINIs, items}); Which is to say passing in an array without actually making the array, or do I need to do it like this: object[] o = new object[] {newINIs, items}; StartScreen.mCP.talkTime("#FM", "01", o); Something like the first way would be better more useful, but Visual Studio doesn't like it, so... - Munty
Hi. Try something like this
StartScreen.mCP.talkTime("#FM", "01", new object[]{newINIs, items});
I don't know if it'll work, but try it. One never know. ASBESTOS-Greetings -
Hi. Try something like this
StartScreen.mCP.talkTime("#FM", "01", new object[]{newINIs, items});
I don't know if it'll work, but try it. One never know. ASBESTOS-Greetings -
No problem ASBESTOS-greeting LiquidE
-
Yeah, but I'm now creating a temporary array inside the method call, which is how I wanted it. Plus if I call half a dozen methods, I dont have to remember what names I've used for the arrays previously. (The contents of the array assumed to be different for every call because it's something the user can modify whenever he wants to) - Munty
-
Yeah, but I'm now creating a temporary array inside the method call, which is how I wanted it. Plus if I call half a dozen methods, I dont have to remember what names I've used for the arrays previously. (The contents of the array assumed to be different for every call because it's something the user can modify whenever he wants to) - Munty
-
Is there any way to do something like this: StartScreen.mCP.talkTime("#FM", "01", {newINIs, items}); Which is to say passing in an array without actually making the array, or do I need to do it like this: object[] o = new object[] {newINIs, items}; StartScreen.mCP.talkTime("#FM", "01", o); Something like the first way would be better more useful, but Visual Studio doesn't like it, so... - Munty
The easiest way to do it is to create a new collections class. The collection class can be of whatever you need. Now your parameter is the class object. You populate it with what you need in the parent method, pass in the populated class to the called method.
-
The easiest way to do it is to create a new collections class. The collection class can be of whatever you need. Now your parameter is the class object. You populate it with what you need in the parent method, pass in the populated class to the called method.
Nah, because I'd still need to adjust the collections class before I used the method, because the contents of the array changes every time the method is used. The array can be null; a string; a string and a boolean; an array, 2 booleans and a string; etc, and it's contents will be different every time it's called. All in all, much easier to use the (new Object{}) code to pass stuff into the method. - Munty