Impressions of C#
Aug 10, 2009, 14:01 (6 Talkback[s])
"Since handling an event is so tedious, they are often quite
generic and you have to check the arguments for what actually
happened. The one good thing about it is it's clear OOP with no
magic.
"Handling events in pure C/C++ usually involves callbacks with
function pointer voodoo. Qt provides a very nice type safe layer
with signals and slots, with an almost ideal syntax, but the
implementation is questionable and magical.
"C# has events built into the language. A class can have events
with specific arguments and can invoke them much like Qt signals.
Events have types that identify their signatures, so it's type safe
and no magic. However, that's also where it gets clunky. For every
event with different arguments you need to also declare a delegate
for the type (from what I understand but haven't read into yet, C#
3.0 provides some generics to make this less tedious). When
connecting an event, you need to create an instance of the
delegate."
Complete
Story
Related Stories: