Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public delegate void Print(int value);
- public static void Main()
- {
- PrintHelper(PrintNumber, 10000);
- PrintHelper(PrintMoney, 10000);
- /* NEW METHOD */
- PrintHelper(PlusTwentyFive, 9975);
- /* ~ returns ~
- * Number: 10,000
- * Money: $10,000.00
- * NumberPlusTwentyFive: 10,000 */
- }
- public static void PrintHelper(Print delegateFunction, int numToPrint)
- {
- delegateFunction(numToPrint);
- }
- /* NEW METHOD */
- public static void PlusTwentyFive(int num)
- {
- Console.WriteLine("NumberPlusTwentyFive: {0,-12:N0}", (num + 25));
- }
- public static void PrintNumber(int num)
- {
- Console.WriteLine("Number: {0,-12:N0}", num);
- }
- public static void PrintMoney(int money)
- {
- Console.WriteLine("Money: {0:C}", money);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement