static object GetSomething(bool b) => b ? 1 : "two";
static string Print(object input) => input switch {
int val => $"is int: {val}",
String val => $"is string {val}",
_ => throw new InvalidOperationException($"Invalid type {input.GetType().Name}"),
Console.WriteLine(Print(GetSomething(true)));
Console.WriteLine(Print(GetSomething(false)));
Console.WriteLine(Print(false));
public abstract record SumType {
public record IsInt(int val) : SumType {};
public record IsString(string val) : SumType {};