S
sklett
I've finally had the time to make use or predicates and convert a bunch of
ugly loops over to predicates. SO much cleaner.
Anyway, my question is if there are plans (or maybe already existing) to add
List<> function that would call a predicate on every item like a process.
For example:
public static Predicate<MyObject> ApplyTax(float taxRate)
{
return delegate(MyObject item)
{
item.Tax = taxRate;
};
}
List<MyObject> objects = new List<MyObject>();
// code to add a ton of objects to the list
ojects.ProcessAll( ApplyTax(7.75) );
Is there anything like that already existing? I haven't seen anything, but
maybe I'm just dense.
Thanks for reading,
Steve
ugly loops over to predicates. SO much cleaner.
Anyway, my question is if there are plans (or maybe already existing) to add
List<> function that would call a predicate on every item like a process.
For example:
public static Predicate<MyObject> ApplyTax(float taxRate)
{
return delegate(MyObject item)
{
item.Tax = taxRate;
};
}
List<MyObject> objects = new List<MyObject>();
// code to add a ton of objects to the list
ojects.ProcessAll( ApplyTax(7.75) );
Is there anything like that already existing? I haven't seen anything, but
maybe I'm just dense.
Thanks for reading,
Steve