Open main menu

Changes

C-Sharpe

263 bytes added, 10:38, 14 June 2021
Undo revision 2762 by 5.253.207.38 (talk)
C# Is a modern, [[OOP|object-orientated programming (OOP)]] language created by Microsoft in 2002 for their all new .NET Framework. Since '02, C# has been used across many frameworks for all different types of platforms. For example; Windows has .NET Framework; Andoird & IOS have [https://www.xamarin.com/ Xamarin]; Windows, OSX, and Linux have [http://www.mono-project.com/ Mono]. There are other frameworks that support C#, but they're the well less known.
Note: Everything below assumes you're using windows.
==== Topbar ====
[[File:Vs sidebar.png|1000px]]
We will not breakdown everything on this bar just yet, it will just introduce confusion. The only thing on this bar that a relevant to us right now is the start button and save button.
 
==== Solution Explorer ====
==== 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====Explanation of code, blocks, and other things [https://s.msger.us/i/3cf31d6cL3Zm.png click here (image)] <code>
using System;
using System.Collections.Generic;
}
</code>
 
(sorry about the broken code tags)
 
==== Complete Hello World ====
[[File:Csharpe project view.png|670px]]
133,597

edits