+ 1

C# argument, string and output

Hi! What are the [ ] and 'args' doing in the following lines of code?( I'm a begginer at programming and still learning from this app, I want to know how those 2 things are changing the code since the application didn't tell me {yet at least}) static void Main(string[], args) int = x x = 89 Console.writeline(x) // Outputs 89

17th Sep 2018, 12:46 AM
Ilie Laurentiu
Ilie Laurentiu - avatar
5 Réponses
+ 4
A lot of languages provide a method to receive command line arguments. Your program gets treated as a command, when you run it, and the values you enter, after it's mention, are given to the program via args. args is an array of strings.
17th Sep 2018, 1:03 AM
John Wells
John Wells - avatar
+ 5
void indicates the return type that would not return any value, static means :you can run the code without making an instance (object), (your main method takes an argument of type string )
17th Sep 2018, 1:06 AM
Michael
Michael - avatar
+ 1
Thanks!
17th Sep 2018, 1:04 AM
Ilie Laurentiu
Ilie Laurentiu - avatar
0
sorry 🙏, In C. Sharp. Want to know how to do a prediction at the search. Is it helpful to (complete automatic)
17th Sep 2018, 9:23 PM
n abdallah
n abdallah - avatar
0
sorry 🙏, In C. Sharp. Want to know how to do a prediction at the search. Is it helpful to (complete automatic)
17th Sep 2018, 9:23 PM
n abdallah
n abdallah - avatar