I'd like to avoid this kind of #if. You can define a base GtkCellRenderer class that subclasses Gtk.CellRenderer. For gtk2, this class would override Renderer and call a new OnRender overload. For gtk3 the class would be empty. In this way, the CanvasRenderer only needs to subclass GtkCellRenderer and won't have any #if. This trick can be used in all classes that have different virtual methods for gtk2 and 3.