I
think this is a case where you need to use contravariance in the
MapFunc
delegate:
public delegate void MapFunc<in V>(Iapi i, V doc);
If I understand this correctly, this says that the
MapFunc
can take any type that is
V
or derived from
V
.
Disclaimer: I haven't needed to use this in anything I've written.