Coding Exercise: delegates
Let's test your understanding of delegates.
We'll cover the following
Problem
This activity uses delegates
for a naming program. Create a console application for a naming concatenation app that meets the requirements 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
for the defined method in the above requirement. -
Call the defined method by a
delegate
variable.
Sample input
Delegate method will receive two string
parameters, e.g.
"David", "Smith"
Expected output
The finished output of the program should look like the example below:
David Smith
Get hands-on with 1400+ tech skills courses.