Sunday, 15 May 2011

c# - Determine if LINQ Enumerable contains object based on a condition? -



c# - Determine if LINQ Enumerable contains object based on a condition? -

this question has reply here:

linq contains method object 4 answers

i have ienumerable<project>

i want know if list has element project.id == someid.

is there way that?

yes, want utilize any method (documentation).

ienumerable<project> projects = somemethodreturningprojects(); if(projects.any(p => p.id == someid)) { //do something... }

c# linq ienumerable

No comments:

Post a Comment