private ConcurrentQueue<string> Names= new ConcurrentQueue<string>();
var sourceFile = new OpenFileDialog
{
Filter = @"(*.txt)|*.txt",
RestoreDirectory = true
};
if (sourceFile.ShowDialog() != DialogResult.OK)
return;
try
{
Names = new ConcurrentQueue<string>(File.ReadAllLines(sourceFile.FileName));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
var l = Names.ToList();
foreach (var s in l)
{
SaveText(@"C:\Windows\Temp\Names\Surname.txt", s);
}
Слишком долго сохраняет. есть-ли способы оптимизировать на скорость?