Write your first C# program!

Status
Not open for further replies.

iFlames

Active Member
1,001
2009
18
0
NOTE: THIS TUTORIAL IS KINDA CONTINUED FROM MY PREVIOUS TUT. Click here to view my previous tut.

As usual we start off with the simplest program - Hello, World!

Code:
public class Hello
{
     public static void Main(string[] args)
     {
       System.Console.WriteLine("Hello, World! \n");
     }
}

System.Console.WriteLine()

Console is a class that belongs to the System namespace. A namespace is a collection of classes. The System namespace contains the method WriteLine(), which displays the enclosed text on the screen. The Console class has other methods, which are used for various input/output operations. The character (.) is used to access the function, WriteLine(), which is coded in the Console class of the System namespace.

The preceding line can also be written as Console.WriteLine() if the statement using System is included as the first line of the code.

The Escape Characters

To display special characters such as the New line character or the backspace character, you need to use escape characters.

I have listed the escape characters used in C# :

\' - Single quotation mark
\" - Double quotation mark
\\ - Backslash
\0 - NULL
\a - Alert
\b - Backspace
\f - Form feed
\n - New line
\r - Carriage return
\t - Horizontal tab
\v - Vertical tab
 
10 comments
You should try and make people actually write the code themselves. Most will probably copy and paste it in visual studio and feel like there now awsome C# coders.
 
You should try and make people actually write the code themselves. Most will probably copy and paste it in visual studio and feel like there now awsome C# coders.

i agree
but they have to learn first
i m thinking of giving them some programs as "assignment" :P
thanks for your suggestion ;)
 
I am kind of interested to learn C#. What can you doing with C#? (I asked just cuz I wanna hear "your" answers) :) Can it make uploader/downloader programs?
 
You can make pretty much any desktop application.

such as Rapidshare elacher
Download er
Scanner
Searchers
Botnets
video Players
media Players
Database Storage
Http Web Server

The list is endless
 
you are limited only by your imagination. You can be the best coder in the world, but without imagination, you cannot put your skill to use.
 
Status
Not open for further replies.
Back
Top