So, what

Cassio

Well-known member
Joined
Nov 30, 2002
Messages
276
Location
Rio de Janeiro
Last edited by a moderator:
I think the argument can be summed up with this statement, from MS:
The truth is that delegates are simpler than inner classes for event scenarios.

When I want to maintain something, I want simplicity. I dont care about saving 2 nanoseconds on an event. Generally speaking, whatever code is running in the event is going to be significantly longer than the time it takes to get into the function/method.

Ill agree that delegates are a bit weird (a new Type and they have global scope) and confuse most people at first. Truth is, most Windows programmers wont use them except as event handlers for their controls.

If you invest some time in learning "true" OO programming, you will find many more uses for them - they form the basis for notification between components. As the recent "Design Patterns in C#" book mentions, you can use interfaces to accomplish the same thing, but delegates make the code "cleaner" - that is, easier to view and understand.

-nerseus
 
Back
Top