object button = new RadioButton { Checked = true };
bool result = button switch
RadioButton radioButton => radioButton.Checked,
CheckButton checkButton => checkButton.Checked,
_ => throw new NullReferenceException()
Console.WriteLine(result);
public bool Checked { get; set; }
public bool Checked { get; set; }