小白,一个关于c# helloworld里面的一些问题,具体情况如下所示!

namespace point
{
class Program
{
public class greetings
{
public static void EnglishGreeting()
{
Console.WriteLine("Hello World!");
}
public static void SpanishGreeting()
{
Console.WriteLine("Ciao,mondo!");
}
public static void ItaliamGreeting()
{
Console.WriteLine("Hola,imundo!");
}
delegate void greetingdele();
class hello
{
static void Main(string[] args)
{
int iChoice = int.Parse (args[0]);
greetingdele[] deletest =
{
new greetingdele (greetings.ItaliamGreeting),
new greetingdele (greetings .EnglishGreeting),
new greetingdele (greetings .SpanishGreeting)
};
deletest[iChoice -1]();

}
}
}
}
}

问题1:int.Parse(args[0])这句是什么意思?
问题2:deletest[iChoice-1]()是怎么一一访问到委托数组的元素的?
问题3:Main方法里的参数 string[] args 有什么用?

慕的地10843
浏览 210回答 2
2回答

哆啦的时光机

greetingdele[] deletest ={new greetingdele (greetings.ItaliamGreeting),new greetingdele (greetings .EnglishGreeting),new greetingdele (greetings .SpanishGreeting)};可能要改成greetingdele[] deletest =new greetingdele[]{new greetingdele (greetings.ItaliamGreeting),new greetingdele (greetings .EnglishGreeting),new greetingdele (greetings .SpanishGreeting)};
打开App,查看更多内容
随时随地看视频慕课网APP