Posts Tagged ‘threading’
Delegates in .NET
I received the following question:
What is a delegate? What problem does it solve? and When might I use a delegate?
A delegate is essentially a function pointer. We have used function pointers in various scenarios in the past to solve the problem of needing to execute user-defined code inside of another function or to fire events using the observed/observable programming pattern.
The problem we’ve always had with function pointers in the past is that there has never been any type safety. If I had a variable that was supposed to point to a function, I could assign it any function. So if the function the code is expecting returns a string and takes an integer and a string as parameters, I could assign the variable a function that returned nothing (void) and passed nothing. My code would compile, but when I got to that function, the chances are my code would blow up on me.
Other Related Items:
SP400 Smart-Pointer (Silver) 2.4Ghz RF Wireless Presenter with Mouse Function and Laser PointerSP400 Smart-Pointer 2.4Ghz RF Wireless Presenter with Mouse Function and Laser Pointer enables you to control your onscreen presentations within a ran... Read More >
Mennon DV-s 37 Screw Mount 37mm Digital Video Camcorder Lens Hood with Cap, BlackThe robust lens hoods of the DV series are specifically designed for the permanent use on digital video cameras, to protect the exposed and se... Read More >


