Just today, I am going to be teaching those noobs some basic c# sharp stuff. Things you will need.:
Open a console application in c#
Ok, So let's get started. This si going to nice and short. Let's start off with comments shall we. Comment is the same as in nearly every other programming language. Here is is.
Knowing that, You are going to need to place this code at the very start because if you don't have this code nothing will run at all. Here is the code.
Now let's move on a class. Now, For me, it is not highly important to have a specific class, as this is not a hight developed tutorial. You can put any.
Now, because you have got the class there you are now going to want to define it below. You will have to use the "main" function, This is used and tell the computer that you want it to be a program.
You are now going to want to actually make the program produce the hello world. It should look something like this.
Now, let's say you're wanting to exit the program but it does not let you? You would do this.
Let's make sure the windows stays open while we are debug mode.
Another comment, to show how to run the program
Now, This is what the code looks like all together.
You have just created your first program.
- Visual stuido 2010. 2012, 2013
- a brain
Open a console application in c#
Ok, So let's get started. This si going to nice and short. Let's start off with comments shall we. Comment is the same as in nearly every other programming language. Here is is.
Code:
//Hello world
Knowing that, You are going to need to place this code at the very start because if you don't have this code nothing will run at all. Here is the code.
Code:
using: System;
Now let's move on a class. Now, For me, it is not highly important to have a specific class, as this is not a hight developed tutorial. You can put any.
Code:
class Hello world
Now, because you have got the class there you are now going to want to define it below. You will have to use the "main" function, This is used and tell the computer that you want it to be a program.
Code:
{
static void main(){
}
}
You are now going to want to actually make the program produce the hello world. It should look something like this.
Code:
Console.WriteLine(""Hello world);
Now, let's say you're wanting to exit the program but it does not let you? You would do this.
Code:
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
Let's make sure the windows stays open while we are debug mode.
Code:
//Keep window open in debug mode
Another comment, to show how to run the program
Code:
//Press F5 to run it
Now, This is what the code looks like all together.
Code:
Using system;
class hello world {
static void main() {
console.WriteLine("Hello world");
Console.WriteLine("Press any key to exit");
Console.ReadKey();
//Keep open in debug mode
//Press F5 to run
}
}
You have just created your first program.