Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. // IEventParameterBase la 1 interface rỗng
  2. public delegate void EventDelegateGeneric (T eventParam) where T : IEventParameterBase;
  3.  
  4. private delegate void EventDelegate(IEventParameterBase eventParam);
  5.  
  6. public EventDelegate myDelegate;
  7.  
  8. public void AddDelegate(EventDelegateGeneric eventDelegate) where T : IEventParameterBase
  9. {
  10. // Tai sao cai lamda express kia lai co the chuyen duoc tu EventDelegateGeneric thanh EventDelegate?
  11. // và nếu viết thành một hàm riêng thì cái lamda đó sẽ được viết như thế nào?
  12. EventDelegate internalDelegate = (eventParam) => eventDelegate((T)eventParam);
  13.  
  14. myDelegate += internalDelegate
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement