Chaining Delegates with Return Values
Posted by: AspNetResources.com articles, news and updates,
on 23 Jul 2005 |
View original | Bookmarked: 0 time(s)
While reading Developing Application Frameworks in .NET by Xin Chen I came upon an interesting gotcha with chained delegates when each of them returns a value.
Suppose we have the following delegate:
public delegate int CalculationHandler (int x, int y);
This delegate can handle a method which takes two numbers, performs their addition, multiplication, etc, and returns a result. Let’s define a contrived class with each method having the signature of our delegate.
public class Math
{
public...