C# Tutorials - Herong's Tutorial Examples - v3.32, by Herong Yang
First Program in C#
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.
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 Hello.cs:
class Hello { public static void Main() { System.Console.WriteLine("Hello world!"); } }
To compile and run the program, open a command window and issue the following commands:
C:\herong>set "NET=\windows\Microsoft.NET\Framework\v4.0.30319" C:\herong>%NET%\csc Hello.cs Microsoft (R) Visual C# Compiler version 4.6.1055.0 for C# 5 Copyright (C) Microsoft Corporation. All rights reserved. C:\herong>Hello Hello world!
Congratulation, you have successfully created, compiled, and executed your first C# program!
Table of Contents
Installing .NET Framework 4.6.1 SDK
Logical Expressions and Conditional Statements
Visual C# 2010 Express Edition
C# Compiler and Intermediate Language
Compiling C# Source Code Files
MSBuild - Microsoft Build Engine
System.Diagnostics.FileVersionInfo Class
WPF - Windows Presentation Foundation