Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System; //Delegati Func i Action se nalaze u namespace-u System.
- Action<int> myAction = DoSomething;
- myAction(123); //Ispisuje "123"
- Func<int, double> myFunc = CalculateSomething;
- Console.WriteLine(myFunc(5)); // Ispisuje 2.5
- }
- static void DoSomething(int i)
- {
- Console.WriteLine(i);
- }
- static double CalculateSomething(int i)
- {
- return (double)i/2;
- }
- }
Add Comment
Please, Sign In to add comment