This can be a complex as also an easy solution.
If you file is a small one, then a solution can be very basic
string text = System.IO.File.ReadAllText(@"C:\Users\Public\TestFolder\WriteText.txt");
string[] splittedText = text.Split(' ');
or even in one line
string[] splittedText = File.ReadAllText(@"C:\Users\Public\TestFolder\WriteText.txt").Split(' ');
Otherwise, be more precise on the request and I will point you to the proper direction.
Cheers
EDIT:
Based on the comments here are two quick solutions,
first one, if you are not managing the possible conversion errors
string[] splittedText = File.ReadAllText(@"C:\Users\Public\TestFolder\WriteText.txt").Split(' ');
int[] numbersArray = Array.ConvertAll<string, int>(splittedText, delegate(string str) { return int.Parse(str); });
But as already mentioned, this wel generate an exception if there is a string that can't be parsed...
Or a more orthodox way:
string[] splittedText = File.ReadAllText(@"C:\Users\Public\TestFolder\WriteText.txt").Split(' ');
List<int> numbers = new List<int>();
int b;
foreach (string digit in splittedText)
{
if (int.TryParse(digit, out b))
numbers.Add(b);
}
int[] numbersArray = numbers.ToArray();
Hope this helps.