重複の可能性:
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)
{
}
私は何をすべきか ?