C#, pronounced c sharp, is a computer language used to give instructions that tell the computer what to do, how to do it, and when to do it. This is a universal language that is used on many operating systems , including Microsoft Windows. C# is one of the languages used in the Microsoft .NET Framework. The Microsoft .NET Framework is a library of objects that create or draw things on the computer.
The C# language is used to create applications that display on a black window referred to as the DOS prompt or DOS window.
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:
Code:
> md C:\learncs
> cd C:\learncs
> C:
Now you should create your first C# program, type "notepad hello.cs" and type (in the notepad)
Code:
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...
Bookmarks