C# Tutorial For Beginners (Part I)

So you just install .NET framework and want to start using C# but you don't know where to start ? well...

First you could download this complete tutorial here. There is a directory for each tutorial with a build.bat to build the tutorial and a run.bat to run the program. And every example is already compiled, just in case...

You should first open a DOS command shell. (If you don't know what it is, clic on the Start menu then run (at the bottom) and type, in the text field: "cmd".
exercise: there is an easiest way to do that, try to find it.)
You should begin to work in an empty directory for this. let call it "C:\learncs". Type in the shell:

> md C:\learncs
> cd C:\learncs
> C:


Now you should create your first C# program, type "notepad hello.cs" and type (in the notepad)

using System;

public class Hello
{
public static void Main()
{
Console.WriteLine("Hello C# World :-)");
}
}


the using keyword just let you write Console at line 7, instead of System.Console. It's very usefull shortcut when you use a lot of "class" define in System.
Save the file.
Now you could compile. Type in the DOS Shell again and type:
csc /nologo /out:hello.exe hello.cs
You probaly have some errors, correct them, compile again, and now you have a working hello.exe program... type hello, see...

Comments

Leave a Reply

Awards

100 Blog Indonesia Terbaik


IP
Powered by Blogger.