1. Home
  2. Computing & Technology
  3. C / C++ / C#

C# Tutorial - Getting Started

By , About.com Guide

2 of 8

A New Project - The Tiniest Application

A New Project

In Visual C# 2005, create a new project. Make it a console application. We'll cover Windows applications later on, but for now it's console apps. Type in lesson1a in the Name edit field and press the Ok button.

You should see this code.

using System;
using System.Collections.Generic;
using System.Text;

namespace lesson1a
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }
}
This is the smallest application and it does... nothing. Press the F6 key and it will compile. You should see Build Succeeded in the bottom left of the screen. Now add this line.
            Console.WriteLine("Hello World") ;
Between the curly braces just after the line
static void Main(string)[] args)
Press F6 again and it should compile ok. Now Press F5, a console window will open and if you are lucky you might see Hello World for a fraction of a second before the window closes. Add this line and recompile and rerun.
            Console.ReadKey();
This time when you press F5 it will wait until you press a key then close.

On the next page : What Just Happened?
Explore C / C++ / C#
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#
  4. C# / C Sharp
  5. Learn C Sharp
  6. Typing Your First C# Program

©2009 About.com, a part of The New York Times Company.

All rights reserved.