不能跨程序集边界使用,因为它具有作为嵌入式互操作类型的泛型类型参数 [英] Cannot be used across assembly boundaries because it has a generic type parameters that is an embedded interop type

查看:28
本文介绍了不能跨程序集边界使用,因为它具有作为嵌入式互操作类型的泛型类型参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 VB.Net 中将 Sub 更改为函数时遇到此错误

I am facing this error on changing a Sub to a Function in VB.Net

类型 System.Collection.Generic.List(Of mshtml.IHTMLDocument2) 不能跨程序集边界使用,因为它具有作为嵌入式互操作类型的泛型类型参数.

有人知道怎么解决吗?

推荐答案

将返回类型从 List(Of mshtml.IHTMLDocument2) 更改为 IList(Of mshtml.IHTMLDocument2)IEnumerable(mshtml.IHTMLDocument2) 解决了这个问题.

Changing the return type from List(Of mshtml.IHTMLDocument2) to IList(Of mshtml.IHTMLDocument2) or IEnumerable(Of mshtml.IHTMLDocument2) resolves the issue.

这篇关于不能跨程序集边界使用,因为它具有作为嵌入式互操作类型的泛型类型参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆