public static UserControl build_editor(PyWrapper.RenmasProperty property) { Type t = property.GetType(); if (t == typeof(PyWrapper.IntProperty)) { IntEditor ed = new IntEditor(); ed.set_target((PyWrapper.IntProperty)property); return ed; } else if (t == typeof(PyWrapper.FloatProperty)) { FloatEditor ed = new FloatEditor(); ed.set_target((PyWrapper.FloatProperty)property); return ed; } else { //TODO -- better message string msg = "Unknown type"; throw new Exception(msg); } }