Why isn't params used in the Main method? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why isn't params used in the Main method?

It is my understanding that the params modifier allows for, among other things, a function call with no parameters. How can the program be executed with no arguments when params isn't used in the Main method? In other words, if we are allowed to run the program with no command-line arguments, why don't we have to write the following: static void Main(params string[] args) { } Thanks!

19th Mar 2017, 3:21 AM
Roy Beng Leong Sieh
Roy Beng Leong Sieh - avatar
3 Answers
0
How so? You just showed me the code without the use of the params modifier. Also, I'm asking about C#, not Java. Your code would produce an error in C#.
21st Mar 2017, 11:30 AM
Roy Beng Leong Sieh
Roy Beng Leong Sieh - avatar
- 1
actually they are
21st Mar 2017, 7:43 AM
Eldar Bakerman
- 1
Public static void Main(String[] args) {}
21st Mar 2017, 7:44 AM
Eldar Bakerman