April 2002
Intermediate to advanced
1024 pages
23h 26m
English
A delegate is similar to a COM (or a C# interface for that matter) interface in that a COM interface specifies a contract between the implementer and the user. A COM interface was abstract and could not be instantiated. Its importance was the contract that it specified. A delegate is similar, but it only specifies a contract for a single function call.
To create a delegate, you first need to define what the delegate is to look like—in other words, define a delegate type. The code snippet in Listing 14.1 begins a simple HelloWorld sample with a delegate definition. The full source for the code in Listings 14.1–14.8 is in the HelloWorld directory.
public delegate void HelloWorldDelegate(string ... |
Read now
Unlock full access