|This rule is Obsolete|
|Synopsis:||Consider an |
|Category:||Delegates and events|
If you provide a method as the target for a delegate, the compiler will only ensure that the method signature matches the delegate's signature.
This means that if you have two classes providing a delegate with the same signature and the same name, and each class has a method as a target for that delegate, it is possible to provide the method of the first class as a target for the delegate in the other class, even though they might not be related at all.
Therefore, it is sometimes better to use interfaces. The compiler will ensure that you cannot accidentally provide a class implementing a certain interface to a method that accepts another interface that happens to have to same name.