This sample demonstrates the delegate types. It shows how to map delegates to static and instance methods, and how to combine them to create multicast delegates.
Security Note |
---|
This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended. |
To build and run the Delegates samples within Visual Studio
Open the solution (Delegates.sln).
In Solution Explorer, right-click the Delegates1 project and click Set as StartUp Project.
On the Debug menu, click Start Without Debugging.
Repeat the preceding steps for Delegates2.
To build and run the Delegates samples from the Command Line
Use the Change Directory command to change to the Delegates1 directory.
Type the following:
csc bookstore.cs bookstore
Use the Change Directory command to change to the Delegates2 directory.
Type the following:
csc compose.cs compose