C # is one of Microsoft's languages for working with. Net. This language includes a wide range of features, which allow different applications to be developed.
C # is a programming language orientated towards the object and resembles several C++ language aspects. In this tutorial, our first application can be developed.
We will then explore various data types in the C # language as well as control flow statements. This is a basic console application.
An application for a console is an application that can be launched in the Windows prompt. For any beginner on .Net, the first step is ideally to build a console application.
Step 1. The first step is to create a new Visual Studio project. We must therefore choose the New->Project menu option when the Visual Studio is launched.
Step 2. The next step is to use a console application for the project type. The name and location of our project must also be mentioned here.
We get the output below in Visual Studio if we follow the steps above.
Output
Step 3. Let us now write down our code which can be used in the console application to view the "Hello World" string.
Note: Every code in the program.cs file must be entered below. When the console application is running the code will be used to write "Hello World".
C# Hello World Program
using System;
namespace DemoApplication
{
class Program
{
static void Main(string[] args)
{
Console.Write("Hello Word!");
Console.ReadKey();
}
}
}
"using"
is used in our console application for the import of existing .net modules. For any. Net application, these modules are necessary to work correctly. The bare minimum code to work with a Windows machine is included."Class"
each class belongs to a namespace."Write"
.ReadKey()
to read the console key. The program will wait and not leave immediately when entering this code line. The program will wait before the user finally leaves any key. If this statement is not included in the code, the program will be released as soon as it is executed.
Setp 4. Run the program with .Net. We need to click Visual Studio to run any program.
Output:
The following output will be displayed when the above code has correctly been entered and the program executed successfully. We can see clearly from the output that the "Hello World" string is shown correctly. The Console .Write
declaration causes the string to be sent to the console.
.Write
method to write console content.enum
keyword is declared.
C# Hellow World Console Appliction