-
Notifications
You must be signed in to change notification settings - Fork 2
CSharp Basics HelloWorld
Joe Care edited this page Dec 22, 2025
·
1 revision
This lesson walks through a minimal "Hello, World!" program and a few variables.
Related wiki pages:
- Overview:
CSharpBible.md - Basics of
Console.WriteLine:CSharp-Basics-ConsoleWriteLine-DateTime.md
Official docs:
- Your first C# program: https://learn.microsoft.com/dotnet/csharp/fundamentals/program-structure/
using System;
namespace HelloWorldProject
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
}using System;
namespace HelloWorldProject
{
class Program
{
static void Main(string[] args)
{
int score = 100;
string name = "Alice";
double pi = 3.14159;
Console.WriteLine("Hello, World!");
Console.WriteLine("Name: " + name);
Console.WriteLine("Pi: " + pi);
}
}
}From a terminal:
dotnet new console -n HelloWorldProject
cd HelloWorldProject
# replace Program.cs with one of the examples
dotnet run- Combine this with input from
Lesson20.12.2025.md. - Explore more examples in
CSharp-Basics-ConsoleWriteLine-DateTime.md.