泛型 错误 无法将类型 “class1” 转换为“class1”

ghao0 ghao0 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我的函数
public void Myfunction(class1<typeBase> 参数)
{
...
}
希望传入参数的类型class1<type1>
type1继承于typeBase
如何做到?

如果直接传会报错!
class1<type1> 参数1;
....

Myfunction(参数1);

编译报错
泛型 错误 无法将类型 “class1<type1>” 转换为“class1<typeBase>”
...全文
评论 30
收藏 已收藏
分享
返回顶部
ghao0
C# 111,129 成员 642,539 内容