Advertisement
Caminhoneiro

Lambda

Jun 21st, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.38 KB | None | 0 0
  1. SubmitButton.Click += (s,e) => MessageBox.Show("Button Clicked");
  2.  
  3. delegate int AddDelegate(int a, int b);
  4. static void Main(string[] args){
  5. AddDelegate ad = (a,b) => a + b;
  6. int result = ad(1,1); //result = 2
  7. }
  8.  
  9. delegate bool LogDelegate();
  10. static void Main(string[] args)
  11. {
  12. LogDelegate ld = () =>
  13. {
  14. UpdateDatabase();
  15. WriteToEventLog();
  16. return true;
  17. };
  18. bool status = ld();
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement