您好,我需要从字符串列表中获取字符串项目并将其添加到我尝试这样的 int 数组,但它写给我错误不能隐式地将 int 类型转换为 int [] 但在序列中我只将一个 int 添加到数组中的一项所以请问有什么问题
private void buttonGenerateO_Click(object sender, EventArgs e)
{
List<string> AgentNumbers = new List<string>();
List<string> AgentRide = new List<string>();
int pocet = AgentNumbers.Count;
int[][] dvouRozmernePole = new int[2][];
dvouRozmernePole[0] = new int[pocet];
dvouRozmernePole[1] = new int[pocet];
foreach (string AgeNumb in AgentNumbers)
{
for (int i = 0; i < dvouRozmernePole[0].Length; i++)
dvouRozmernePole[i] = Convert.ToInt32(AgeNumb);
}
foreach (string AgeRide in AgentRide)
{
for (int i = 0; i < dvouRozmernePole[1].Length; i++)
dvouRozmernePole[i] = Convert.ToInt32(AgeRide);
}