using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Delegate{ public delegate void Task(); class Program { static void Main(string[] args) { Task[] task = { MethodA, MethodB, MethodC}; string resp; do { Console.WriteLine("Task-A"); Console.WriteLine("Task-B"); Console.WriteLine("Task-C"); Console.WriteLine("X exit"); resp = Console.ReadLine(); if (resp.ToUpper() == "X") { break; } try { int choice = int.Parse(resp) - 1; task[choice](); } catch { Console.WriteLine("Invalid number"); } } while (true); Console.ReadLine(); } public static void MethodA() { Console.WriteLine("A doing"); } public static void MethodB() { Console.WriteLine("B doing"); } public static void MethodC() { Console.WriteLine("C doing"); } }}