foreach (var c in Controls) { //if (btn.GetType() == typeof(Button btn)) if (c is Button btn) { ElipseControl el = new ElipseControl(); el.TargetControl = (Control) btn; el.CornerRadius = 20; }