class DM_Matrix {
public string[] DMInput_Name = new string[] {};
public string[] DMOutput_Name = new string [] {};
public int[] DMInput = new int[] { 99, 1, 2, 3, 4 };
public int[] DMOutput = new int[] { 99, 1, 2, 3, 4 };
}
public void Initialize() {
foreach (var i in DM_Matrix.DMInput_Name) {
CrestronConsole.PrintLine("[DM.Module.Input_Name"
+ DM_Matrix.DMInput_Name[i]);
}
}
Compiler error on "i":
"(local variable) string i
ERROR cannot implicitly convert type 'string' to 'int'"
I'm trying to print every the whole DM.Module.Input_Name array
I've tried to set use "int i" instead of "var i" or cast i from string to integer buy no joy. Not sure why "i" is recognised as string. In my understanding it should be recognised as "int" for the array.
DM_Matrix.DMInput_Name[i].iitself is the string item coming fromDM_Matrix.DMInput_Namecollection. So you can simply doCrestronConsole.PrintLine("[DM.Module.Input_Name" + i);