1、二维数组
string[,] strClickZB=new string[,]{{"0,9000","9000,9000","9000,6000","6000,3000"},
{"3000,12000","3000,6000","",""},
{"6000,9000","6000,3000","",""}
};
BridgeDraw(strClickZB);
public static void BridgeDraw(string[,] strClickZB){
for(int i=0;i<strClickZB.GetLength(0);i++){ //二维数组GetLength(0)行数
for(int j=0;j<strClickZB.GetLength(1);j++){ //二维数组GetLength(1)列数
var ClickZB=strClickZB[i,j];
repo.MainWnd_PMS_AzSoft.cmd_Line.PressKeys(ClickZB);
Delay.Milliseconds(200);
repo.MainWnd_PMS_AzSoft.cmd_Line.PressKeys("{Return}");
}
repo.MainWnd_PMS_AzSoft.cmd_Line.PressKeys("{Return}");
}
repo.MainWnd_PMS_AzSoft.cmd_Line.PressKeys("{Escape}");
Report.Info("行数:"+strClickZB.GetLength(0)+"\r\n列数:"+strClickZB.GetLength(1));
}
2、锯齿数组
string[][] a=new string[3][];
a[0]=new string[]{"0,9000","9000,9000","9000,6000","6000,3000"};
a[1]=new string[]{"3000,12000","3000,6000"};
a[2]=new string[]{"6000,9000","6000,3000"};
BridgeDraw(a);
public static void BridgeDraw(string[][] strClickZB){
for(int i=0;i<strClickZB.Length;i++){ //strClickZB.Length行数已定义为3
for(int j=0;j<strClickZB[i].Length;j++){ // strClickZB[i].Length 列数
var ClickZB=strClickZB[i][j];
repo.MainWnd_PMS_AzSoft.cmd_Line.PressKeys(ClickZB);
Delay.Milliseconds(200);
repo.MainWnd_PMS_AzSoft.cmd_Line.PressKeys("{Return}");
}
repo.MainWnd_PMS_AzSoft.cmd_Line.PressKeys("{Return}");
}
repo.MainWnd_PMS_AzSoft.cmd_Line.PressKeys("{Escape}");
}