I have code:
protected void Method1(List<SomeClass> mylist)
{
foreach(var item in mylist)
{
if (!SomeClass.Validate(item))
{
continue;
}
DoStuff(item);
}
}
protected void Method2(List<SomeClass> mylist)
{
foreach(var item in mylist)
{
if (!SomeClass.Validate(item) || item.Value == 0)
{
continue;
}
DoStuff(item);
}
}
how to organize these two methods?
they have a difference of only item.Value == 0 can use lambda expressions.
I have no idea
So you can use:
Or: