What is the difference between these two statements by the delegate?

I look at delegates for the first time and wonder what the difference is between the 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.

+4
source share
1 answer

The first is the Anonymous method , and the second is the name method.

See Also Delegates with Named and Anonymous Methods (C # Programming Guide)

+10
source

Source: https://habr.com/ru/post/1436408/


All Articles