为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

C# C
慕的地10843 2021-07-15 15:11:56
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 有什么用?
查看完整描述

2 回答

?
哆啦的时光机

TA贡献1779条经验 获得超6个赞

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)
};


查看完整回答
反对 回复 2021-07-25
  • 2 回答
  • 0 关注
  • 209 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信