gpt4 book ai didi

c# - 错误 CS0234 : The type or namespace name 'CustomMarshalers' does not exist in the namespace 'System.Runtime.InteropServices'

转载 作者:太空宇宙 更新时间:2023-11-03 23:12:09 25 4
gpt4 key购买 nike

using System;    
using System.Collections;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.CustomMarshalers;

namespace mshtml
{
[DefaultMember("item"), CompilerGenerated, Guid("3050F21F-98B5-11CF-BB82-00AA00BDCE0B"), TypeIdentifier]
[ComImport]
public interface IHTMLElementCollection : IEnumerable
{
void _VtblGap1_3();
[DispId(-4)]
[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(EnumeratorToEnumVariantMarshaler))]
IEnumerator GetEnumerator();
}
}

上面的代码给我以下错误:

Error CS0234: The type or namespace name 'CustomMarshalers' does not exist in the namespace 'System.Runtime.InteropServices' (are you missing an assembly reference?)

请教如何解决?这是一个反编译代码,我是 C# 的初学者。

最佳答案

你必须包含 CustomMarshalers.dll
示例:
使用项目添加引用 -> 添加引用 -> 浏览 -> 转到位置 "C:\Windows\assembly\GAC_32\CustomMarshalers\2.0.0.0__b03f5f7f11d50a3a" -> 选择 CustomMarshalers.dll

关于c# - 错误 CS0234 : The type or namespace name 'CustomMarshalers' does not exist in the namespace 'System.Runtime.InteropServices' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38800275/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com