Question: Create a console application named delegatesAndEvents with the following requirements: 1. Declare a delegate type that takes a string as an argument. 2. Create a

Create a console application named delegatesAndEvents with the following requirements: 1. Declare a delegate type that takes a string as an argument. 2. Create a function named testFun that takes a string argument name and write the name out to the console. 3. Inside the Main function create an instance of the delegate and initialize it with the function. 4. Invoke the delegate to test it using your name as the argument. 5. Add a lambda expression to the delegate using Multicasting that takes a string argument name and write the name out to the console. 6. Invoke the delegate and observe the results. 7. Create a class named Instructor with the following requirements: a. Declare a public delegate named InstructorEventHandler(). b. Declare an event of type InstructorEventHandler named travelEvent. c. Public Boolean property named Traveling. d. private int property named daysBeforeReturning e. A getter for daysBeforeReturning that returns the value of the property. f. A setter for daysBeforeReturning which set its value and a test to see if the Instructor is Traveling and if daysBeforeReturning is equal to one or less. If instructor is Traveling and the number of days before returning is one or less the raise the event named travelEvent. 8. In Main create a new instructor instance named teacher. 9. Subscribe to the travelEvent handler, this will cause the event handler code to be generated for you. 10. Modify the event handler to write to the console "The Instructor will return tomorrow". 11. Set teacher.Traveling to True and teacher.DaysBeforeReturning to 5. a. Did this kick off the event handler? 12. Set teacher.Traveling to False and teacher.DaysBeforeReturning to 0. a. Did this kick off the event handler? 13. Set teacher.Traveling to True. a. Did this kick off the event handler? Discuss why not on the discussion forum. 14. Set teacher.DaysBeforeReturning to 1. a. Did this kick off the event handler? This is what I am trying to create in Visual Stuidio C#

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!