可能重复:
如何将 String 转换为 Int?
public List<int> GetListIntKey(int keys)
{
int j;
List<int> t;
t = new List<int>();
int i;
for (i = 0; ; i++)
{
j = GetKey((keys + i).ToString());
if (j == null)
{
break;
}
else
{
t.Add(j);
}
}
if (t.Count == 0)
return null;
else
return t;
}
问题就出在这条线上:
j = GetKey((keys + i).ToString());
我收到错误说:
无法将类型“string”隐式转换为“int”
现在GetKey
函数是字符串类型:
public string GetKey(string key)
{
}
我该怎么办 ?