C
C#7mo ago
IamMax420

why is there "string[] args" inside the main function parentheses?

Hello, I've just started learning c# (after doing some c++) and I wonder why it's like that since we don't even use it inside the main function, like it's just there and I'd like to know why
8 Replies
leowest
leowest7mo ago
its just the default signature template of Main used when u create a console project, you can also make it Main()
TheRanger
TheRanger7mo ago
its optional, you dont have to put it
Jimmacle
Jimmacle7mo ago
you can use it, it's the same as argc/argv in c++ it contains the arguments used to run the program
TheRanger
TheRanger7mo ago
if you run in cmd
yourprogram.exe hello world
yourprogram.exe hello world
the first element in the array would be "hello" and the 2nd element in the array would be "world"
Jimmacle
Jimmacle7mo ago
the first argument is the full path to the executable, no?
IamMax420
IamMax420OP7mo ago
Ok thanks guys, I get it now
TheRanger
TheRanger7mo ago
No i dont think so not in c# atleast
Jimmacle
Jimmacle7mo ago
seems like you're right
Want results from more Discord servers?
Add your server