|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Help understanding user created DelegatesI have been looking at delegates lately. I have seen several articles
explaining them but I'm having a hard time understanding why I would use a delegate over a traditional function or sub. Could someone please help me understand why i would use a delegate in day to day use, over a function or sub? Thank you for your time! Ron Well, I hope this helps a little. Here's how I use them a lot.
When I add controls at runtime, I use the AddHandler VB function, often, to direct a call of a particular event at one routine I've written to handle the group of controls. This enables me to write only one function to handle the event of the group of controls I've added. This is a very nice feature that is enabled via delegates. Another way delegates can be used, apriori .NET 2.0, is perhaps in collections. Buy using a delegate, I could write different method to handle functionality for different types of object. So, a search function could be handled by a delegate and you could handle search for whatever kind of object. I say apriori because with .NET 2.0 we now have generics. HTH Steve Show quoteHide quote "RSH" <way_beyond_o***@yahoo.com> wrote in message news:u92d9GU8GHA.4776@TK2MSFTNGP02.phx.gbl... >I have been looking at delegates lately. I have seen several articles >explaining them but I'm having a hard time understanding why I would use a >delegate over a traditional function or sub. Could someone please help me >understand why i would use a delegate in day to day use, over a function or >sub? > > Thank you for your time! > Ron > That is very interesting!
I am still having a bit of a problem conceptualizing where I might use this outside of event trapping. Thanks! Ron Show quoteHide quote "RSH" <way_beyond_o***@yahoo.com> wrote in message news:u92d9GU8GHA.4776@TK2MSFTNGP02.phx.gbl... >I have been looking at delegates lately. I have seen several articles >explaining them but I'm having a hard time understanding why I would use a >delegate over a traditional function or sub. Could someone please help me >understand why i would use a delegate in day to day use, over a function or >sub? > > Thank you for your time! > Ron >
Performance of Queue(of T).Enqueue(T)
How to convert a Byte() to an IntPtr in VB load form in vb.net Regex.Split... Can I do this?? Why no patch for the anoying Visual Basic compiler problem control array with code added controls Getting external IP Address Is there a equivalent to 'Last Position' in VS2005? Pause and Stop Search Help System .chm linking problem |
|||||||||||||||||||||||