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);
- /* ~ returns ~
- * Number: 10,000
- * Money: $10,000.00 */
- }
- public static void PrintHelper(Print delegateFunction, int numToPrint)
- {
- delegateFunction(numToPrint);
- }
- 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