I am trying to remove elements from an IEnumerable type from another IEnumerable.
Here I get the complete list
var tiposObj = from t in context.sistema_DocType
select
new tgpwebged.Models.SettingsModels.TipoIndiceModel
{
id = t.id,
tipo = t.tipoName
};
classificacaoModel.tipos = tiposObj.ToList();
And here a partial list to be excluded from the first
var tiposAtribuidosObj = from t in context.sistema_DocType
join c in context.sistema_ClassificacaoTipo on t.id equals c.idTipo
where c.idClassificacao == classificacaoId
select new tgpwebged.Models.SettingsModels.TipoIndiceModel
{
id = t.id,
tipo = t.tipoName
};
classificacaoModel.tiposAtribuidos = tiposAtribuidosObj.ToList();
Here is how I am excluding:
classificacaoModel.tiposNaoAtribuidos = classificacaoModel.tipos.Except(classificacaoModel.tiposAtribuidos);
No elements is excluded from the first list. Can´t figure out why. They have same structure and same types.