public void RegisterCall(PrintMethod methodToCall) { printMethods -= methodToCall; printMethods += methodToCall; }
This will ensure that it is deleted if it is present in the multicast delegate and then added to provide 1 instance.
Adding a handler is not interrupted if a delegate of the same handler is already present in the multicast delegate, because most duplicate times do not occur. There are also acceptable situations where calling the same method twice is what is required (for example, user aggregation on an object or collection).
If they decided that duplication would be eliminated, they would have to throw an exception when adding a handler. This is expensive in many ways, both at runtime and in all the ugly try-catch blocks that we would need to write.
source share