Question: In this exercise, you will create a class with several methods and use delegates to call these methods. Your program should be able to: -
In this exercise, you will create a class with several methods and use delegates to call these methods. Your program should be able to: complete the following exercise: Use a Func delegate that points to multiple methods, each performing a different operation addition subtraction, multiplication on three parameters double int, double Iterate over the invocation list of the Func delegate to call each method individually. Use an Action delegate that points to multiple methods that print results to the console, also performing operations addition subtraction, multiplication on three parameters double int, double Finally, display the output of both the Func and Action delegates. Requirements: Implement a class DelegateDemo with the following methods: o funA: Adds the parameters and returns the result. o funB: Subtracts the second and third parameters from the first and returns the result. o funC: Multiplies all three parameters and returns the result. o funD: Adds the parameters and prints the result. o funE: Subtracts the second and third parameters from the first and prints the result. o funF: Multiplies all three parameters and prints the result. In the Main method: o Create a Func delegate that points to funA, funB, and funC. Iterate through its invocation list and call each method. o Create an Action delegate that points to funD, funE, and funF. Call the delegate to print the results. Expected Output: The program should print the results of each operation performed by both the Func and Action delegates.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
