Open main menu

Changes

C-Sharpe

127 bytes added, 15:20, 28 January 2018
no edit summary
==== Program.cs explanation ====
'''- Now I'll begin to explain the default code in Program.cs.'''
<br />
We want to go over to our IDE (Visual Studio) and locate the Program.cs file in the Solution Explorer. Double click it, and you will be shown the main project file that has the entry point. In this Program.cs file, you will see a few things. Up the top you can see your namespace includes. Namespace includes basically let you include other files, or dependencies. A little under that we can see the namespace of the current file, it will be 'namespace HelloWorld'. Then it will have a block of code. What is a block of code? It's basically all the text between '{' and '}'. '{' is the opening tag, '}' is the closing tag. Within the namespace block of code, we will have the class name, which will be 'class Program' which also has a block of code. Within the Program class block of code, there is our main function. The main function is where we put our code.
==== Adding our code ====
'''- Placing our code in main function.'''
<br />
So, now we simply want to put our WriteLine function and ReadKey function in the main functions block of code (aka entry point). Lets put Console.WriteLine passing the parameter "Hello World," that will look like Console.WriteLine("Hello World");. This is enough to run our application, but it will instantly close. To prevent the closing, we must wait for user input. To wait for user input, put Console.ReadKey(); after the writeline.
 ==== Our code will look like:====<code>
using System;
using System.Collections.Generic;
}
</code>
 
==== Complete Hello World ====
[[File:Csharpe project view.png|670px]]
133,597

edits