Loading...
Search for a command to run...
Loading...
Slide 1 of 5
C# is a modern, type-safe, object-oriented language.
using System;
class Program {
static void Main(string[] args) {
Console.WriteLine("Hello, C#!");
string name = "Alice";
int age = 25;
double salary = 75000.50;
Console.WriteLine($"{name} is {age} years old");
// Nullable types
int? maybeNull = null;
Console.WriteLine(maybeNull ?? -1);
// Var keyword
var message = "type inferred";
// Pattern matching
object obj = "Hello";
if (obj is string str) {
Console.WriteLine($"Length: {str.Length}");
}
}
}