Labels

Friday, September 26, 2014

Build Your first C# Program

After Visual Studio installation, you will be ready to create your first C# Application,and to do that follow my steps.

1-from your start menu click on 'All Programs' and under the Visual Studio folder click on the Visual Studio icon ,see the picture below.

2-after opening the Visual Studio go to the 'File' menu and hover over 'New' then click on 'Project',see the picture below.


3-A window like that shown in the picture below will appear from this window make sure that you select 'Visual C#' from the list on your left then from the list in the center select 'Console Application' ,then below this list change the 'Name' to 'HelloWorld' and press 'OK' ,see the picture below.


A new C# application is now created ,and you should have a screen like this ,see the picture below.


Congratulations ,you have Successfully create a C# Program,now you can run the application using Ctrl+f5 or from the 'DEBUG' menu click on 'Start without Debugging' .
You should get a screen like this,see the picture below.


This blank black screen called a Console Application ,this type of application is used mainly for training and studding the language and it also used for creating a real world application used for specific purposes that we will not talk about it on the blog.

Is that all?

.Now you may ask your self 'is that all?' ,my answer is no ,we just crated a C# Console Application that do nothing ,so let's give the application something to do.

Write your first line of Code.

Now return to the Visual Studio and write this line of code exactly as shown in the next picture:


This line 'Console.WriteLine("Hello World , I AM Developer ");' tells the console application to write some text on the console screen .

Now run the Application again using 'Ctrl+f5' ,you should get the following result as shown in the picture below:


What does this line of code mean?

Lets describe this line 'Console.WriteLine("Hello World , I AM Developer ");'

 The word 'Console' refers to a Dot NET class that contains a lot  of methods (procedures)  that are ready to be used by developers like 'WriteLine' the one we used in this example which tells the Console Application to a line of text on the screen , after the word  'WriteLine' comes two brackets which contains the text that you want to write on the screen surrounded by double quotation ,at the end of statement we notice that there are semicolon ';' , the semicolon tells the application that the statement ends here so the application goes to the next statement.

Whats  Next?

Now we can create a C# application and write some code on it but we still need to learn more about the language .
In the next lessons we will start to learn the language bit by bit ,so go to the next page.

Advertising

No comments:

Post a Comment