United Falcon Clan
Would you like to react to this message? Create an account in a few clicks or log in to continue.

C# - Lesson 1 - General Language Look

Go down

C# - Lesson 1 - General Language Look Empty C# - Lesson 1 - General Language Look

Post  Guest Fri Nov 06, 2009 3:55 pm

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

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


Back to top Go down

C# - Lesson 1 - General Language Look Empty Re: C# - Lesson 1 - General Language Look

Post  Guest Fri Nov 06, 2009 4:16 pm

OW OW OW O OOOOOOOOOOOOOWWWWWWWWWWWW that makes my head hurt

Guest
Guest


Back to top Go down

C# - Lesson 1 - General Language Look Empty Re: C# - Lesson 1 - General Language Look

Post  Guest Fri Nov 06, 2009 4:19 pm

that's because of your tooth Razz

Guest
Guest


Back to top Go down

C# - Lesson 1 - General Language Look Empty Re: C# - Lesson 1 - General Language Look

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum