const string _textFile = "This is the first line in the file\n"
+ "This is the second line in the file\n"
+ "This is the third line in the file\n";
public static void Main()
var utf8 = System.Text.Encoding.UTF8.GetBytes(_textFile);
var memoryStream = new MemoryStream(utf8);
memoryStream.Position = 0;
string[] optionsArray = null;
using (var inOFile = new StreamReader(memoryStream))
while (!inOFile.EndOfStream)
wholeLine = inOFile.ReadLine();
optionsArray = wholeLine.Split(' ');
Console.WriteLine("Reading Line " + ++count);
Console.WriteLine("\tWhole: '{0}'", wholeLine);
Console.WriteLine("\tSplit: '{0}'", string.Join("', '", optionsArray));
Console.WriteLine("Final Options Array: {0}", string.Join(" | ", optionsArray));