Here's my code to read a text file, which happens to be larger than 1GB and is pipe-delimited:
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string strFilePath = @"C:\Users\Me\Desktop\123.txt";
private void button1_Click(object sender, EventArgs e)
{
var arrRawData = File.ReadLines(strFilePath).Select(line => line.Split('|')).ToArray();
}
}
}
When I click the button I get this error:
"System.OutOfMemoryException' occurred in mscorlib.dll"
I have 16GB of RAM...what am I doing wrong?