分享
 
 
 

10.1 Application startup

王朝other·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

10.1 Application startup

Application startup occurs when the execution environment calls a designated

method, which is referred to

as the application’s entry point. This entry point method is always named

Main, and shall have one of the

following signatures:

static void Main() {.}

static void Main(string[] args) {.}

static int Main() {.}

static int Main(string[] args) {.}

As shown, the entry point may optionally return an int value. This return

value is used in application

termination (§10.2).

The entry point may optionally have one formal parameter, and this formal

parameter may have any name. If

such a parameter is declared, it must obey the following constraints:

. The implementation shall ensure that the value of this parameter is not

null.

. Let args be the name of the parameter. If the length of the array

designated by args is greater than

zero, the array members args[0] through args[args.Length-1], inclusive,

must refer to strings,

called application parameters, which are given implementation-defined

values by the host environment

prior to application startup. The intent is to supply to the application

information determined prior to

application startup from elsewhere in the hosted environment. If the host

environment is not capable of

supplying strings with letters in both uppercase and lowercase, the

implementation shall ensure that the

strings are received in lowercase. [Note: On systems supporting a command

line, application parameters

correspond to what are generally known as command-line arguments. end note]

Since C# supports method overloading, a class or struct may contain

multiple definitions of some method,

provided each has a different signature. However, within a single program,

no class or struct shall contain

more than one method called Main whose definition qualifies it to be used

as an application entry point.

Other overloaded versions of Main are permitted, however, provided they

have more than one parameter, or

their only parameter is other than type string[].

An application can be made up of multiple classes or structs. It is

possible for more than one of these classes

or structs to contain a method called Main whose definition qualifies it to

be used as an application entry

point. In such cases, one of these Main methods must be chosen as the entry

point so that application startup

can occur. This choice of an entry point is beyond the scope of this

specification.no mechanism for

specifying or determining an entry point is provided.

In C#, every method must be defined as a member of a class or struct.

Ordinarily, the declared accessibility

(§10.5.1) of a method is determined by the access modifiers (§17.2.3)

specified in its declaration, and

similarly the declared accessibility of a type is determined by the access

modifiers specified in its

declaration. In order for a given method of a given type to be callable,

both the type and the member must be

accessible. However, the application entry point is a special case.

Specifically, the execution environment

can access the application’s entry point regardless of its declared

accessibility and regardless of the declared

accessibility of its enclosing type declarations.

In all other respects, entry point methods behave like those that are not

entry points.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有