using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HelloNamespace
{
class Greetings
{
public static void DisplayEnglish()
{
Console.WriteLine("Hello, world!");
}
public static void DisplayItalian()
{
Console.WriteLine("Ciao, mondo!");
}
public static void DisplaySpanish()
{
Console.WriteLine("Hola, imundo!");
}
}
delegate void delGreeting();
class HelloWorld
{
static void Main(string[] args) {
try {
int iChoice = int.Parse(args[0]);
delGreeting [] arrayofGreetings={
new delGreeting(Greetings.DisplayEnglish),
new delGreeting(Greetings.DisplayItalian),
new delGreeting(Greetings.DisplaySpanish)};
arrayofGreetings[iChoice - 1]();
}
catch(Exception ex) {
Console.WriteLine(ex.Message);
Console.WriteLine("Press any key to continue. . .");
Console.ReadKey();
}
}
}
}