Delegates
-
I am trying to refer some code at http://mokhan.ca/blog/2007/09/25/SALES+TAXES.aspx[^] I couldnt understand the use of delegates as below:
private double CalculateAmount( ) {
double amount = 0d;
Summary( delegate( ITax tax ) { amount += tax.Amount; } );
return amount;
}How and why its being used here????
~AHAGeek
-
I am trying to refer some code at http://mokhan.ca/blog/2007/09/25/SALES+TAXES.aspx[^] I couldnt understand the use of delegates as below:
private double CalculateAmount( ) {
double amount = 0d;
Summary( delegate( ITax tax ) { amount += tax.Amount; } );
return amount;
}How and why its being used here????
~AHAGeek
Summary takes a delegate to calculate tax, however, the Summary method seems out of place since there is nothing to provide a return value to amount meaning the only possible action the summary method can perform is to sum all of the applied taxes.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.