andybeeeeee
Programmer
Trying to read some data from a file. I'm reading in 4 lines and storing them in a 2D array and then starting again. Here's the code i'm using:
when i try to it i get quite a few errors which i dont understand. can anyone help me with the following:
Cannot implicitly convert type 'string[*,*]' to 'string[]'
Wrong number of indices inside [], expected '1'
The second error applies to multiple lines inside the for loop, each of the lines when i reference the array
Any help?
Code:
Console.WriteLine("Please enter the absolute path of the file: ");
string path = Console.ReadLine();
String[] TempArray = new String[100, 4];
FileStream file = new FileStream (path, FileMode.Open, FileAccess.Read);
StreamReader sk = new StreamReader(file);
for (int i=0; i<99; i ++)
{
string s = sk.ReadLine();
s = TempArray [i, 0];
string t = sk.ReadLine();
s = TempArray[i, 1];
string u = sk.ReadLine();
s = TempArray[i, 2];
string v = sk.ReadLine();
s = TempArray[i, 3];
}
sk.Close();
file.Close();
when i try to it i get quite a few errors which i dont understand. can anyone help me with the following:
Cannot implicitly convert type 'string[*,*]' to 'string[]'
Wrong number of indices inside [], expected '1'
The second error applies to multiple lines inside the for loop, each of the lines when i reference the array
Any help?