How to Program in C# : Introduction to the Basics (Part 1)
Welcome my aspiring hackers and programmers!
Today i will introduce you to a programming language that as a hacker you should have in your set of hacking/programming skills (except if you're only interested in web hacking/programming...then you should go learn some html or PHP instead of C#).
First...let me brefly introduce the history of this language.
C# (pronounced C Sharp)...it's a programming language developed by Microsoft for its .NET framework in the early 2000.
(Very brief intro... I know, right?)
So...I will be using Xamarin Studio for Windows in the series of How Tos (you can find it here. You will have to fill in some infos about you). If you want to program in C# on Linux then you have 2 options:
1) Use whatever text editor you like and then save the file with the .cs extension
2) Download MonoDevelop which is a Linux version of Xamarin (go over this page and follow the instructions to install it or leave a comment if you want me to make a tutorial on how to install it)
Let's start coding :D!!
Now let's launch Xamarin and let's create a new Solution
Then let's select Console Project
And now let's choose a name for our project and a slightly different name for our Solution (in case we'll have multiple projects in the same Solution directory)
Don't forget to check the "Create a project within the solution directory box"
There you go!
Now you created a project that you don't understand...yet ...Great!!!!!
Mine has different colors than yours because i changed them because of the too much brightness of the white color scheme...no big deal (if you want to know how to change color scheme just ask in the comments).
If you're new to programming you have to understand that learning a programming language it's done step by step with very small steps...so sit comfortable because we have a long way to go and most important everything i will show you , you will have to type it too because programming isn't something you're going to learn by just reading.
With that said...let's move on!
For now we're only going to focus on the code in the curly brackets after the public static void Main line just keep it simple for now.Just keep in mind that class and namespaces are a way to keep things organized.
Ok...so...First of all remember that C# is case sensitive , so capitalization is important.
The first thing we're going to do is press on the play button in the top left corner of Xamarin , that's what we use to test the code that we wrote. You're going to notice that if you hit play that's only going to show a window appear and disappear very quickly...We can avoid that by telling the program to wait for us to type something before closing and we do that by typing:
Console.WriteLine ("Hello World");
Basically the word Console tells the System to WriteLine (write) what we tell him (in this case Hello World!) between the parentheses () and closing the line with the ";"
Ok so you now know how Console.WriteLine and Console.ReadKey "work".
For length reasons i'm going to stop this How To here but don't worry
i'll be back very soon to continue programming with you in C# !!
In the next How to I'll talk about Variables!!
Thanks for reading