kisame1313

Утр. занятие 29.07 №2

Jul 29th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections;
  4.  
  5. namespace Programz
  6. {
  7.     public delegate void MD ();
  8.  
  9.     class Program
  10.     {
  11.  
  12.         public delegate int Del (int a, int b);
  13.  
  14.         static void Main ( string [] args )
  15.         {
  16.  
  17.                 int result = DoOperation (5,2, Summ);
  18.             Console.WriteLine ( result );
  19.         }
  20.  
  21.         public static int DoOperation ( int a, int b, Func<int, int, int> operation )
  22.         {
  23.         return operation ( a, b );
  24.         }
  25.        
  26.  
  27.         public static int Summ ( int a, int b ) => a+b;
  28.  
  29.         public static int Diff ( int a, int b ) => a - b;
  30.  
  31.         public static int Mult( int a, int b ) => a * b;
  32.  
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment