C# - Lesson 1 - General Language Look
Page 1 of 1
C# - Lesson 1 - General Language Look
Ok let's start with the general look of the C Sharp language.
C#, like many other programming languages, works with so called types. Types are meant to tell the environment what kind of data will be saved in the memorie.
> example: 5 types
Types always stand on top of every C# code.
When we want to use the types we are going to call them in like this
> example: calling types
Typing "using" infront of the type means that we gonna use that kind of data.
As you can see, we always put a ';' behind every line of C# code. Strictly, not behind every line, but only when the next thing that's coming is not included in the procedure above.
When we are creating a program in Visual C#, we will always see this on top of the coding page:
> example: standard coding page
The namespace contains all the coding that is preset for your program. For simple program you will only use one namespace, but when it's gonna contain more functions and forms you will need more namespaces.
Behind namespace we can see the first class of our namespace. This one just contains an initialize component, but as we will bind functions to buttons etc. we will make more classes.
As you can see, C# code is put between a '{' and a '}' , this counts for everything, namespaces, classes etc.
> example: button on click class
This is the class of your button click event. This code will be automatically created if you double click your button in design time. But that's for later.
So, this is the basic structure of a coding sheet.
__________
Next tutorial will go about strings and variables
C#, like many other programming languages, works with so called types. Types are meant to tell the environment what kind of data will be saved in the memorie.
> example: 5 types
- Code:
System
System.Object
System.String
System.Int16
System.Int32
Types always stand on top of every C# code.
When we want to use the types we are going to call them in like this
> example: calling types
- Code:
using System;
using System.Object;
...
Typing "using" infront of the type means that we gonna use that kind of data.
As you can see, we always put a ';' behind every line of C# code. Strictly, not behind every line, but only when the next thing that's coming is not included in the procedure above.
When we are creating a program in Visual C#, we will always see this on top of the coding page:
> example: standard coding page
- Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HereComesTheNameOfYourProgram
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}
The namespace contains all the coding that is preset for your program. For simple program you will only use one namespace, but when it's gonna contain more functions and forms you will need more namespaces.
Behind namespace we can see the first class of our namespace. This one just contains an initialize component, but as we will bind functions to buttons etc. we will make more classes.
As you can see, C# code is put between a '{' and a '}' , this counts for everything, namespaces, classes etc.
> example: button on click class
- Code:
private void NameOfYourButton_Click(object sender, EventArgs e)
{
the methods binded to that click event will be put here
}
This is the class of your button click event. This code will be automatically created if you double click your button in design time. But that's for later.
So, this is the basic structure of a coding sheet.
__________
Next tutorial will go about strings and variables
Last edited by UF Xorax on Sat Nov 07, 2009 2:27 am; edited 2 times in total
Guest- Guest
Re: C# - Lesson 1 - General Language Look
OW OW OW O OOOOOOOOOOOOOWWWWWWWWWWWW that makes my head hurt
Guest- Guest
Similar topics
» C# - Lesson 3 - Conditions
» C# - Lesson 4 - Iterations
» C# - Lesson 2 - Variables & Strings
» 2nd Lesson in SE Phones (Different Files)
» 1st Lesson in SE Phones (Finding Your Firmwire)
» C# - Lesson 4 - Iterations
» C# - Lesson 2 - Variables & Strings
» 2nd Lesson in SE Phones (Different Files)
» 1st Lesson in SE Phones (Finding Your Firmwire)
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|