faster method to import data from text file <p>I have to import data from a text file to a flat file database. I'm sure there's a faster way to load all the data into the database but I don't know how. </p> <pre><code>private void ImportButton_Click(object sender, EventArgs e) { string Path = string.Empty; OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Text File|*.txt"; ofd.ShowDialog(); if (ofd.FileName == string.Empty) return Path = ofd.FileName; string data; using (var sr = new StreamReader(Path)) { data = sr.ReadToEnd(); } var items = data.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); var count = 0; foreach (var info in items.Select(ItemInfo.FromText).Where(info =&gt; info != null)) { count++; info.Index = ++Envir.ItemIndex; Envir.ItemInfoList.Add(info); } MessageBox.Show(count + " Items have been imported"); UpdateInterface(true); } </code></pre>