Wednesday, 4 September 2013

Generic list Foreach loop with conditional statement

Generic list Foreach loop with conditional statement

I am using foreach loop to get generic list items which iterates all
items, but I want to get certain items, with a condition. I am doing it
like following:
foreach (FilesToProcessDataModels item in ListfilesToProcess)
{
if (item.IsChecked)
{
//file operations
}
}
Is there any way that i can do it without if statement, to iterate the
data where item.IsChecked==true in foreach loop.

No comments:

Post a Comment