This is what I need to do:
object foo = GetFoo(); Type t = typeof(BarType); (foo as t).FunctionThatExistsInBarType();
Can something like th
No, you cannot. C# does not implement duck typing.
You must implement an interface and cast to it.
(However there are attempts to do it. Look at Duck Typing Project for an example.)