I have a list of like 3000 items, and I think there are a ton of duplicates. So to make my program run faster, I want to delete them. This is the code along with my function, which when I run the program the text file is empty.
List<string> allCombos = new List<string>();
string here = RemoveTheSame(allCombos, allCombos);
System.IO.File.WriteAllText(@"C:\Hodag Image Storage Folder\creo.txt", here);
//////////////////////////////
private string RemoveTheSame(List<String> lista, List<String> listb)
{
List<String> newList = lista;
newList.AddRange(lista);
for(int i = 0; i < lista.Count; i++)
{
int a = 0;
for(int ii = 0; ii < listb.Count; ii++)
{
if(lista[i] == listb[ii])
{
a += 1;
if(a >= 2)
{
newList.RemoveAt(ii);
a = 0;
}
}
}
}
string wat = "";
for(int i = 0; i < newList.Count; i++)
{
wat += newList[i] + " ";
}
return wat;
}