Solution: delegates
Let's discuss the solution to the coding exercise on delegates.
We'll cover the following
Problem
This activity uses delegates
for a naming program. Create a console application called Naming Concatenation that meets the requirements listed below.
-
Create a method that receives the first and second name as parameters and returns the full name by concatenating them with a space. For example, if a method receives
David
andSmith
as parameters, it should returnDavid Smith
. -
Define a
delegate
variable for the defined method in the above requirement. -
Call the defined method by a
delegate
variable.
Get hands-on with 1400+ tech skills courses.