Posted 12 years ago
·
Author
Hello and welcome to my tutorial series on the popular programming language C# (pronounced C Sharp). This series will assume no previous programming experience or knowledge but if this is the case, it must be read as a series, i.e, start at the first tutorial and work your way up.
I will have to say one thing though, if you are reading this because you seriously want to learn a programming language then do not expect it to be easy. It will be easy at the start but as you work your way up some concepts may be difficult to grasp but don't give up! Remember; practice makes perfect!
As this is the first guide on the series, I thought it would be appropriate to give the reader an introduction to the language itself just to quench any curiosity (I hope!) you have about the language.
C# is an object & component oriented and an event driven language developed by Microsoft in 2001 using the .NET framework. The language had 4 base objectives when being designed; it had to be simple, modern, general purpose and object-oriented. It's name was derived by yet another "programming pun", just like C++ (the ++ is the increment operator, it means C+1), the # in musical notation means up a semitone, meaning that once again this programming language should be a step up (#) from the C programming langugage.
Unlike it's predecessor C++ (C# is heavily influenced by C++, as well as being influenced by Java and more), C# is entirely class based. What this means is that everything in the language is sorted by constructs that can create its own instances/objects.
Now that you know a litte about C# I'm going to show you how to start a new project in Microsoft Visual C# 2010 Express. If you don't know what this is, it is the compiler and IDE (integrated development environment) we will be using - essentially it's a more complex version of Notepad that allows us to make programs. If you don't have this program, download it here.
After downloading it and installing it we can continue. The first thing that must be done when creating a program is to open a new project in our compiler - a project is how we sort the various files needed for our program. To start a new project go to File > New Project > Empty Project then write the name of this project, for example; MyFirstProject.
Once this is done you will have to add a source file. A source file is what our code is wrote into. Right click on your project name in the solution explorer on the right and go to Add > New Item > Code File then name the file, for example; CodeFile.cs. You must make sure that it has a .cs extension as this is how our compiler determines what type of file we are writing.
Once this code file is opened we can begin writing our code. To compile the program into an executable we simply press the green arrow (it looks like a play button) along the top.