Open main menu

Editing C-Sharpe

Warning: The database has been locked for maintenance, so you will not be able to save your edits right now. You may wish to copy and paste your text into a text file and save it for later.

The system administrator who locked it offered this explanation: We are placing MPGH Wiki into a read-only state. If you are interested in contributing content towards this Wiki please contact Silent on MPGH.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
C# Is a modern, 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 less known.
+
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 known.
  
 
Note: Everything below assumes you're using windows.
 
Note: Everything below assumes you're using windows.
Line 24: Line 24:
  
 
==== Topbar ====
 
==== Topbar ====
[[File:Vs sidebar.png|1000px]]
+
[[File:Vs sidebar.png]]
  
 
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.
 
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 ====
 
==== Solution Explorer ====
Line 48: Line 49:
  
  
==== Program.cs explanation ====
 
 
'''- Now I'll begin to explain the default code in Program.cs.'''
 
'''- Now I'll begin to explain the default code in Program.cs.'''
 
<br />
 
<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.
 
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.'''
 
'''- Placing our code in main function.'''
 
<br />
 
<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.
 
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>
==== Our code ====
 
Explanation of code, blocks, and other things [https://s.msger.us/i/3cf31d6cL3Zm.png click here (image)]
 
 
 
<code>
 
 
     using System;
 
     using System;
 
     using System.Collections.Generic;
 
     using System.Collections.Generic;
Line 80: Line 75:
 
     }
 
     }
 
</code>
 
</code>
 
(sorry about the broken code tags)
 
 
==== Complete Hello World ====
 
[[File:Csharpe project view.png|670px]]
 

Please note that all contributions to MPGH Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see MPGH-Wiki:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)