C# Tutorials - Herong's Tutorial Examples - Version 3.2, by Dr. Herong Yang

First Program in C# 1.0

This section provides a tutorial example on how to write the first C# program to print out 'Hello world!' on the screen, compile it and run it on with .NET Framework 1.0.

Let's follow the tradition of the programming language world and write our first C# program to print out "Hello world!" on the screen.

You can use notepad to write the following code and save it as c:\home\herong\csharp\hello.cs:

class Hello {
   public static void Main() {
      System.Console.WriteLine("Hello world!"); 	

To compile and run the program, open command window and issue the following commands:

C:\herong\csharp>csc hello.cs
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.

Hello world!

Congratulation, you have successfully created, compiled, and executed your first C# program!

Last update: 2010.

Table of Contents

 About This Book

Introduction of C# (C Sharp)

 What Is C#?

 Installing .NET Framework 2.0 SDK

 Installing .NET Framework 1.0 SDK

First Program in C# 1.0

 C# Program Structure

 Data Type and Variables

 Logical Expressions and Conditional Statements

 Arrays and Loop Statements

 Data Type Features

 Floating-Point Data Types

 Passing Parameters to Methods

 Execution Environment Class

 Visual C# 2010 Express Edition

 Class Features

 C# Compiler and Intermediate Language

 Compiling C# Source Code Files

 Memory Usages of Processes

 Multithreading in C#

 System.IO.FileInfo Class

 System.Diagnostics.FileVersionInfo Class


 PDF Printing Version

First Program in C# 1.0 - Updated in 2012, by Dr. Herong Yang