What's the point of args if it's optional? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

What's the point of args if it's optional?

Seen included when defining the main method. static void Main(string[ ] args) when static void Main( ) works just as fine?

5th Oct 2016, 2:13 PM
champsammy13
champsammy13 - avatar
1 Respuesta
+ 2
It is used when you are running your program with arguments. In CMD. Example: C:users/sysOP/Desktop> myprogram.exe "Hello" static main(string[] args) { console. writeline(args[0]) // Would echo Hello } Mainly for parsing it stuff.
5th Oct 2016, 2:33 PM
Newuser Noob
Newuser Noob - avatar