Determine if a reflected type can be cast to another reflected type

前端 未结 5 1157
我在风中等你
我在风中等你 2021-01-21 08:07

In .net (C#), If you have two types discovered through reflection is it possible to determine if one can be cast to the other? (implicit and/or explicit).

What I\'m tryi

5条回答
  •  遥遥无期
    2021-01-21 08:39

    So, probably you mean duck typing or structural typing? There are several implementations that will dynamically generate the required proxies.

    For example:

    http://www.deftflux.net/blog/page/Duck-Typing-Project.aspx

提交回复
热议问题