Ctrl
+ F5
to run your project. Visual Studio builds your project, converting the source code into an executable. Then, it launches a command window that runs your new application. You should see the following text in the window:Ctrl
+ Fn
+ F5
to run your project. Visual Studio for Mac builds your project, converting the source code into an executable. Then, it launches a command window that runs your new application. You should see the following text in the window://
convert the rest of the line to a comment./*
and */
characters. This is shown in the following example.Main
method, in which control starts and ends. The Main
method is where you create objects and execute other methods.Main
method is a static method that resides inside a class or a struct. In the previous 'Hello World!' example, it resides in a class named Hello
. You can declare the Main
method in one of the following ways:void
. That means your program doesn't return a value.Main
method, args
, is a string
array that contains the command-line arguments used to invoke the program.System.Console.WriteLine('Hello World!');
uses the WriteLine method. This is one of the output methods of the Console class in the run-time library. It displays its string parameter on the standard output stream followed by a new line. Other Console methods are available for different input and output operations. If you include the using System;
directive at the beginning of the program, you can directly use the System classes and methods without fully qualifying them. For example, you can call Console.WriteLine
instead of System.Console.WriteLine
: