CopyPastehas never been so tasty!

Introduction to my C# Tutorial

by SkyLightna

  • 1
  • 0
  • 0


     Hello everyone, This is Sky Lightna aka Theateat. Today I'm going to attempt to teach you how to code in C#. They say the best way to learn something new is to teach it to someone else so they can understand it. Well, this is exactly what I'm going to do. Recently I started a C# course and I've started to learn the basics of the language like how to do basic functions in visual studio, objects,properties and methods.

     I will start by showing you how to set up your coding environment. The software that I shall be using is Visual Studio 2010. I suppose you can use alternative IDE's if you would like to but as i mentioned earlier I shall be using Visual Studio 2010.I'm assuming that you're all relatively new or completely new to programming. If so you will want to download visual C# 2010 Express which is a free version that Microsoft offers to people who are trying to learn how to program.
     Before I go any further i just want to give you a simple definition of what a program of what a program is. You might find other definitions that are hard to understand and only use programmer jargon but this defition will be simple to understand.
A program is a set of instructions that tell the computer what to do. You could create a simple program that will display the words "Hello World!". That is what the computer will be instructed to do. Its kind of like the relationship between you and your parents. Your parents are the people that created you and brought you into this planet and you have to do what they tell you to do as long as the instructions don't violate your basic human rights or put you in danger.By the way, this is what i consider the difference between a good computer program and a virus. A programmer with malicious intent will code something like a virus that endangers the computer that it is being run on. It is the duty of other programs such as antivirus software which also consist of a set of instructions that tell the computer what to do, to protect the computer. Kinda like a custom made body guard.
     You play the role of the parent and the program is your child. Think of the time you take to code the program as your pregnancy. Depending on what kind of program you're coding as well as its complexity and your programming skill,the length of your pregnancy will vary. Now to get into the real meat of it.

     C# is object oriented which means that every object in C# can have categories and sub categories (Like how the object known as a car in the real world can be first classified as a vehicle and then sub categorised as an Audi or Toyota car. objects can also have properties (data that describes the object) and methods. For example the car can be coloured red which would count as a property and a method of accelerating an decelerating as well as changing direction while driving.
     To access the methods and properties for a console object you simply add a dot beside the object < Console.Write >. In the previous example the object is written in light blue followed by a '.' which is in red which is then followed by the method 'Write' in a darker shade of blue. 
     To call or activate a method place a bracket or parenthesis to the right of the method <Console.Write("Hello World!")>
N.B  Anything written between the two quotation marks is called a string (A.K.A. text)
     What the line <Console.Write("Hello World!")> does is it tells the computer to send anything withing the quotation marks and the parentheses to the console's write method. The write method is going to take the data within the string and do something to the console window which is going to display the text. Please not that every statement must be terminated by a semicolon ';'. A statement is basically a small piece that fits into a larger application just like how a sentence fits into a larger book.
Now let's try debugging (F5) and see what happens:
Notice how the hello world is on the same line as the press any key to continue. To get Hello world on its own line just use 'WriteLine' instead of just 'Write'. 
See how they both have a separate line?
Well that's all I'm going to teach you in this video

Add A Comment: