- Beginning C# 7 Hands-On:Advanced Language Features
- Tom Owsiak
- 94字
- 2025-04-04 18:04:55
Adding delegates
In the first stage, you have to add delegates. While you could put these into a separate file, for our purposes let's just place them here. So, enter the following above the line beginning with public partial class...:
public delegate bool Compare(double x, double y);
Remember, delegates are function or method wrappers, actually. Then, directly below this line, enter the following:
public delegate double Multiply(double x, double y);
You can see here that we have two delegates. One returns a Boolean data type, and the other one returns a double data type.