I fixed it ^^
private void Form2_Load(object sender, EventArgs e)
{
openFileDialog1.Title = "Open Links List";
openFileDialog1.Filter = "Text File|*.txt";
openFileDialog1.FileName = "";
openFileDialog1.ShowDialog();
var file = openFileDialog1.FileName;
if (file != "")
{
StreamReader read = new StreamReader(file);
var items = read.ReadToEnd();
string[] urls = items.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
var count = urls.Count();
int i = 0;
string[] item = new String[count];
foreach (string u in urls)
{
item[i] = u.Replace("\r", String.Empty);
i++;
}
read.Close();
string[] new_urls = RemoveDups(item);
StreamWriter write = new StreamWriter(file);
foreach (string u in new_urls)
{
write.WriteLine(u);
}
write.Close();
}
}
public string[] RemoveDups(string[] s)
{
return s.Distinct().ToArray<String>();
}