April 2002
Intermediate to advanced
1024 pages
23h 26m
English
delegates can be compared. A delegate overrides the equality operator (==) and the (!=) operator. These two operators in turn rely on the Equals method that is an overridden method for the delegate class. Similar to the way strings can be compared by value and not by reference, the Delegate class compares the value of the delegate rather than the reference. For a delegate, the value consists of the values exposed by the Method and Target properties seen in Listings 14.5 and 14.8. If the Method and Target properties are the same, then the delegates are considered to be equal. Two different instances will obviously have different Targets, so delegates defined on different instances will be considered different. In addition, ...