Generic Delegate

By Michael Flanakin @ 1:36 PM :: 232 Views :: 0 Comments :: (Open), .NET, (Unreported) :: Digg it!

I'd like to have the ability to create a generic delegate to specify strong types of parameters. I imagine this should be fairly simple for the compiler team, but don't know if it's come up before. This would save casting in event abstract event handlers. For instance...

delegate void EventHandler<T>(T sender, EventArgs e);
delegate void EventHandler<T, E>(T sender, E e);

I want to say every event handler I've seen sends this (or Me, for you VB hedz), so there's no reason we should have to cast, leaving room for invalid casts and declining performance (albeit minor) for developers who aren't keen on these issues.

Ratings

Comments

Currently, there are no comments. Be the first to post one!
Click here to post a comment



Archives Archives

Categories Categories

Related Links Related Links