This is a rather elementary C# question; my apologies, but I haven't been able to find this elsewhere.
What is the best way to convert from Object<class>
to Object<interface>
?
I.e.
//fake interface
interface ignu {}
//fake class which implements fake interface
class bee : ignu {}
//function which accepts a generic with the interface
function bang(template<bee>) {}
//template type but with a class that implements the interface
template<bar> foo;
//trying to call the function, but compiler complains it can't implicitly convert
bang(foo);
//compilers complains that it cannot convert from template<bee> to template<ignu>
bang((template<ignu>)bee)
Maybe I'm way off base, but this seems like it should work and be doable, but the solution is escaping me.
Edit: Changed mygen to be template as I was using both to refer to the same thing which was confusing
Edit: I ended up using a Cast similar to: bang(bee.Cast());