.txtファイルからintの配列から2d配列にロードしようとしていますが、「mscorlib.dllで「System.FormatException」タイプの未処理の例外が発生しました」と表示されます。ループと関係があると思います。おそらく範囲外になります。しかし、C#は初めてなので、困惑しました。
「nRow[r]= Convert.ToInt32(row [r]);」で中断します
protected void read_lvl()
{
IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile("myFile.txt", FileMode.Open, FileAccess.Read);
using (StreamReader reader = new StreamReader(fileStream))
{ //Visualize the text data in a TextBlock text
while (!reader.EndOfStream)
{
//for each row
for (int i = 0; i < rows; i++)
{
//read in the line
string myLine = reader.ReadLine();
//take out the commas
string[] row = myLine.Split(',');
//convert to string to ints
int[] nRow = new int[row.Length];
for(int r=0; r<row.Length;r++){
nRow[r] =Convert.ToInt32(row[r]);
}
//feed back into the array
for (int j = 0; j < columns; j++){
myreadArray[i, j] = nRow[j];
}
}
}
}
}