This code works well thanks to you. How do I prevent duplicate items in listBox1? What should I change the code below?
listBox1.Items.AddRange(textBox2.Lines.Select(l => textBox1.Text + " " + l).ToArray());
foreach (var item in textBox2.Lines.Select(l => textBox1.Text + " " + l).ToArray()) { if (!listBox1.Items.Contains(item)) listBox1.Items.Add(item); }
IEnumerable<string> lines = textBox2.Lines.Distinct(); listBox1.Items.AddRange(lines.Select(l => textBox1.Text + " " + l).ToArray());
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)