"Switch Expressions"

// Assuming 'user' is a variable of type 'User':
var salary = user switch {
	Manager m when m.ManagerialLevel is ManagerialLevel.CLevel => 100_000, // C-Level managers get 100,000
	Manager m when m.ManagerialLevel is ManagerialLevel.UpperManagement => 70_000, // Upper managers get 70,000
	Manager _ => 50_000, // All other managers get 50,000
	_ => 30_000 // Everyone else gets 30,000
};


Code snippet taken from "Complete C# Quick Reference - C# 8".