Click here to Skip to main content
15,890,185 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In console application main how do we know that string[] args is optional?
Because in c# we write optional parameter as
C#
public static int Maintain(int Nar=1)
{
    return 1;
}

how string[] args is optional?
Posted
Comments
Maciej Los 6-Aug-15 3:49am    
Are you sure that string[] is optional?
_Dhull 6-Aug-15 5:16am    
Yes, In console application it is parameter in main method.

static int Main(string[] args)
{
return 0;
}

1 solution

Main is the entry point of the application and is handled has a special case. Documentation[^] say it all:
The Main method can be declared with or without a string[] parameter that contains command-line arguments.
 
Share this answer
 
Comments
Maciej Los 6-Aug-15 4:55am    
5ed!
CPallini 6-Aug-15 5:11am    
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900