var vehicle = GetRandomVehicle();
var printed = vehicle switch
Car or Plane => $"You got a {vehicle}",
Train { Capacity: var cap } => $"You got a train with {cap} seats",
_ => "You got something else"
Console.WriteLine(printed);
static Vehicle GetRandomVehicle() =>
Random.Shared.Next(0, 3) switch
0 => new Car("Olive", "Bradley"),
record Car(string Color, string Type) : Vehicle;
record Train(long Capacity) : Vehicle;