First of all, your model (structure) is wrong!
I'd suggest to create Category object this way:
public class Category
{
private string sdescription = string.Empty;
private string scode = string.Empty;
public Category(string _description)
{
sdescription = _description;
}
public Category(string _description, string _code)
{
sdescription = _description;
scode = _code;
}
public string Description
{
get { return sdescription; }
set { sdescription = value; }
}
public string Code
{
get { return scode; }
set { scode = value; }
}
}
Now, your list could look like:
List<Category> Categories = new List<Category>()
{
new Category("Books", "001"),
new Category("Cars", "002"),
new Category("Tools", "003")
};
And another list of categories (CategoryCode):
List<string> lst = new List<string>()
{
"Cars",
"Dogs"
};
Finall query:
var CategoriesNotOnLst = Categories
.Where(x => !lst.Any(z => x.Description==z))
.ToList();
Result:
Description Code
Books 001
Tools 003