I'm looking at delegates for the first time and wondered what the differnce is between these two styles.
OfferList.NextPage += delegate(int page)
{
OnNextPage(page);
};
void OnNextPage(int page)
{
...
}
and
Toolbar.OfferBookmarkRemoved += new OfferBookmarkRemoved(OnOfferBookmarkRemoved);
void OnOfferBookmarkRemoved(int offerId)
{
...
}
Thanks in advance.
The first one is an Anonymous Method, and the second is a Name Method.
See also Delegates with Named vs. Anonymous Methods (C# Programming Guide)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With