Tuesday, January 9, 2007

Learning c# (chapter_1)

Introducing C#
C# is closely same Java.C# is a case-sensitive language.All c# class need to import some classes from System name space.Let start your first C# program.Open the text editor ,write like this and save as HelloWorld.cs.When you creating your first program,please remember this c# is case-sensitive,so becareful when you creating.If you come from Java ,please remember Main method in c# is not need to add parameter.And then If you want to add ,It is also ok!.Let start.Please be sure to install .net frame work.
your First program -
//import namespace
using System;

//create class HelloWorld
class HelloWorld {
static void Main() {
System.Console.WriteLine("Hello friend ,How are you?");
}
}


C# need to compile and then run like java.first java compile .java file to byte code and then translate it.c# also do like this.Now If you finish to compile ,run like this.In c# firstly compile to assemble and then run it.


Now ,compile like this

- csc.exe HelloWorld.cs ( compile )
- HelloWorld or HelloWorld.exe ( run )

c# keyword




please look this keyword ,You can't create class , method and variable name like keyword name .please remember.
:) to be continue.

No comments:

Google Ad