I am trying to add some logic in this. But I am not sure how to add a second condition…
For instance:
foreach (FolderAssetInfo e in folderAssetsList)
{
var foundAsset = databaseAssetsList.Find(a => a.AssetFullName == e.AssetFullName);
//I want to add an AND logic inside the parenthesis such as:
//a => a.AssetFullName == e.AssetFullName && a.AssetFirstName == e.AssetFirstName)
if (foundAsset != null)
{
Console.WriteLine(Found it!);
}
}
How can I do that?
Your syntax is perfect:
Basically, the
Predicate<T>is just syntax that will return a boolean value. Your syntax in the comment (a.AssetFullName == e.AssetFullName && a.AssetFirstName == e.AssetFirstName) will return a boolean, as written, so it will work fine for the predicate.The one place where you do have a syntax error is your call to
Console.WriteLine– this will require you to add quotation marks: