Hi Guys. I need some help on simplifying my method
I have this method
public double ComputeBasicAmount(double basicLimit, double eligibleAmt)
{
return basicLimit * eligibleAmt;
}
sample usage:
Foo foo = new Foo(100, 1000);
double basicAmt = ComputeBasicAmount(foo.BasicLimit, foo.EligibleAmt)
The problem here is I want the eligibleAmt to be dynamic because sometimes it's not really only the eligbleAmt what I'm passing to the method.. like this
Foo foo = new Foo(100, 1000);
double basicAmt = ComputeBasicAmount(foo.BasicLimit, foo.EligibleAmt/foo.RoomRate)
My solution is use the Func delegate as a parameter but i don't know how to use it properly
i want something functional like this
public double ComputeBasicAmount<T>(double basicLimit, Func<T, double> multiplier)
{
return basicLimt * multiplier;
}
double basicAmt = ComputeBasicAmount<Foo>(foo.BasicLimit, x => x.EligibleAmt/x.RoomRate)
can someone help me. thanks in advance...