C
C#8mo 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
leowest8mo ago
its just the default signature template of Main used when u create a console project, you can also make it Main()
TheRanger
TheRanger8mo ago
its optional, you dont have to put it
Jimmacle
Jimmacle8mo ago
you can use it, it's the same as argc/argv in c++ it contains the arguments used to run the program
TheRanger
TheRanger8mo 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
Jimmacle8mo ago
the first argument is the full path to the executable, no?
IamMax420
IamMax420OP8mo ago
Ok thanks guys, I get it now
TheRanger
TheRanger8mo ago
No i dont think so not in c# atleast
Jimmacle
Jimmacle8mo ago
seems like you're right
Want results from more Discord servers?
Add your server