I'm trying to get a big string text array from a TextBox where lines are string[]
.
It works but the problem is that with big amounts of data in input the GUI of program is frozen for a moment while it processes the entire size of the array (differently from async functions which don't let GUI to lag). To avoid the freeze? I'm trying to use parallel for but the result seems the same... How can I fix this?
string[] text = textBox.Lines;
if (textBox.Lines.Length > 0)
{
Parallel.For(0, textBox.Lines.Length, x =>
{
text[x] = textBox.Lines[x];
});
}
FIXED:
string[] text = textBox.Lines;
if (text.Length == 0)
{
MessageBox.Show("Insert lines", "Error");
}