Public class collection
{
Public string exceptionId;
Public string exceptionname;
}
//here judge whether there is a code, the code can be normal use, but do not need to use lambda expressions if use the Exits to see if elements exist?
If (a list. The Exists (TMP=& gt; TMP. ExceptionId====false)
id){
////added
The collection collection=new collection ();
Collection. ExceptionId=id;
Collection. Exceptionname=idname;
//list. Add (collection);
}
Parameters need Predicate
Don't know how to write back,
Meaning is the one in the list collection. The Id is consistent with the Id of the incoming parameters do not add to the list
Thank you very much!
CodePudding user response:
Their overloaded compare method, comparative object propertiesCodePudding user response:
If (a list. The where (x=& gt; X.I d==id). ToList () Count> 0)CodePudding user response:
Do not use lambda expressions, is how to doCodePudding user response:
To the second floorCodePudding user response:
ConcurrentDictionaryAddOrUpdate
CodePudding user response:
Var exist=list. Any (item=& gt; Item. ExceptionId==id);If (exist)
{
//todo: if there is a logical
} the else
{
//todo: if there is no logical
}
CodePudding user response:
Sweat, need not lambda...