1
I created a list with 13 filenames, which I extracted using Getfilename(). Another list I broke a txt file and loaded these names into another list. So I have this:
ListaNomeArquivo
ListaNomeTxt
I need to get the name of the Listfilename list and see if it exists within Listfilename. Both Contains and Equals, always returns different and I have the same names. Just to illustrate. I have that name on both lists:
web\\ace\\asp\\ace0003a.asp
Turns out the lambda I did says they’re different:
var busca = listaCommiter.Where(l => !l.Contains(listaFarm.ToString()));
How do I only store what doesn’t really exist?
The complete code of this routine:
private List<string> ComparaArquivo()
{
List<string> listaCommiter = new List<string>();
List<string> listaFarm = new List<string>();
List<string> listaDiferenca = new List<string>();
try
{
listaCommiter = _listaCommiter();
listaFarm = _listaFarm();
var busca = listaCommiter.Where(l => !l.Contains(listaFarm.ToString()));
return listaDiferenca;
}
catch(Exception ex)
{
string r = ex.Message;
return null;
}
}
The list in return listaDiferenca; is returning nothing because I’m still developing. It will return busca.
But you want to return only what you have in
listaFarmand does not have inlistaCommiteror anything that is not in both?– Uilque Messias