Hello World Prior to C# 9.0
namespace Example
{
class HelloWorld {
static void Main(string[] args) =>
System.Console.WriteLine("Hello World!");
}
}
Hello World Program in C# 9.0
using System;
Console.WriteLine("Hello World!");
Hello World Program in C# 10.0 or Later
Console.WriteLine("Hello World!");
If you compile and run this program, you will get the following output:
Hello World!
What's Next
If you are interested in learning C# programming, then you will need a .NET development tools. You can use .NET CLI or Microsoft Visual Studio.
- Next Step: C# development environment setup
C C++ Clojure Crystal D Dart Erlang F# Go Haskell Java Javascript Julia Kotlin Lua Python Rust Scala Swift Typescript