If your file is in the above mentioned format, then you can write the code something like this:
internal int[] loadArray(string path)
{
StreamReader sr = new StreamReader(path);
int[] num=new int[0];
try
{
while (!sr.EndOfStream)
{
string[] temp = sr.ReadToEnd().Replace('\n',' ').Split(' ');
num = new int[temp.Length];
for (int i = 0; i < temp.Length; i++)
{
if (!int.TryParse(temp[i], out num[i]))
{
throw new InvalidDataException();
}
}
}
return num;
}
catch (Exception ex)
{
throw ex;
}
finally
{
sr.Close();
}
}