HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Before we learn the basic building blocks of C # programming language, let us look at a minimum of C # program structure, to serve as reference for the next chapter.
A C # program includes the following components:
Let's look at a can print out "Hello World" simple code:
using System; namespace HelloWorldApplication { class HelloWorld { static void Main (string [] args) { / * My first C # program * / Console.WriteLine ( "Hello World"); Console.ReadKey (); } } }
When the above code is compiled and executed, it produces the following results:
Hello World
Let's look at each part of the above program:
WriteLineis a methodof the Consoleclass in theSystemnamespace definition. This statement will be displayed on the screen message "Hello, World!".
The following points are noteworthy:
If you are using Visual Studio.Net C # compile and execute the program, please follow the steps below:
You can also use the command line instead of the Visual Studio IDE to compile a C # program: