Skip to Content
.NET Common Language Runtime Unleashed
book

.NET Common Language Runtime Unleashed

by Kevin Burton
April 2002
Intermediate to advanced content levelIntermediate to advanced
1024 pages
23h 26m
English
Sams
Content preview from .NET Common Language Runtime Unleashed

Comparing delegates

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, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Customizing the Microsoft® .NET Framework Common Language Runtime

Customizing the Microsoft® .NET Framework Common Language Runtime

Steven Pratschner

Publisher Resources

ISBN: 0672321246Purchase book