I have an interesting question regarding C# code. Basically I have to call a method
BCI2000AutomationLib.IBCI2000Remote.StartupModules(ref System.Array)
Using Visual Studio 2010 the following code compiles and works perfectly:
// Startup modules
string[] modules = new string[3];
modules[0] = "SignalGenerator --local";
modules[1] = "DummySignalProcessing --local";
modules[2] = "DummyApplication --local";
ok_conn = bci.StartupModules(ref modules);
Now porting this to a game engine (e.g. Unity 3D) requires some stricter C# code since it uses Mono C# compiler. So for the same code i get the following compilation error:
The best overloaded method match for 'BCI2000AutomationLib.IBCI2000Remote.StartupModules(ref System.Array)' has some invalid arguments Argument 1: cannot convert from 'ref string[]' to 'ref System.Array'
Can you please give an advice on how to rewrite this code block to a more strict coding to resolve the stated error?
Change the type of you variable to System.Array
// Startup modules
Array modules = new string[3]
{
"SignalGenerator --local",
"DummySignalProcessing --local",
"DummyApplication --local"
};
ok_conn = bci.StartupModules(ref modules);
Your method StartupModules takes a ref Array as argument ; it can set the variable to any other Array. Not necessarily a string Array, it could be an int[]. That's why you cannot call with a variable typed as Array of string.