爲什麼這給出IndexOutOfRange
異常?IndexOutOfRange異常
string[] achCheckStr = File.ReadAllLines("achievements.txt");
if (achCheckStr[0] == ach1_StillBurning) // this is where the exception occurs
{
setAchievements(1);
}
if (achCheckStr[1] == ach2_Faster)
{
setAchievements(2);
}
是否驗證你實際上得到使用調試器中的文件的內容? –
添加此:if(achCheckStr!= null)在我之前(achCheckStr [0] == .... – mok
添加一個斷點並確認'achCheckStr'有數據... – sab669