M
moondaddy
I'm trying to learn how to use generic delegates, event handlers and
methods. To do so I built a small sample Console app to see how this can
work. I got it working using the EventHandler<T> from the system name space
but with out using a generic method to pass into my delegate.
By the way. EventHandler<T> doesn't seem so generic as it uses 'object
sender' as the first parameter.
Next I converted the method to a generic method and created my own generic
event handler 'MyEventHandler<T>' that is generic. Problem is that I can't
get this to compile. Rather than trying to explain where and how its not
compiling, I'll just zip and attach the project. Can someone please see why
its not compiling and make recommendations on the most appropriate way to
create a generic delegate and method?
Thanks.
methods. To do so I built a small sample Console app to see how this can
work. I got it working using the EventHandler<T> from the system name space
but with out using a generic method to pass into my delegate.
By the way. EventHandler<T> doesn't seem so generic as it uses 'object
sender' as the first parameter.
Next I converted the method to a generic method and created my own generic
event handler 'MyEventHandler<T>' that is generic. Problem is that I can't
get this to compile. Rather than trying to explain where and how its not
compiling, I'll just zip and attach the project. Can someone please see why
its not compiling and make recommendations on the most appropriate way to
create a generic delegate and method?
Thanks.