gpt4 book ai didi

c# - c++ 中的 string* [] 转换为 c# 中的 string[]

转载 作者:太空狗 更新时间:2023-10-29 23:01:07 37 4
gpt4 key购买 nike

我是 dot net 的初学者。我的疑问如下:- 在 dll 中,函数将 string* [] 作为其参数之一。现在这个方法需要在c#中使用。此 dll 引用已添加到 c# 项目。现在在 c# 项目中,当按 f12 即此函数的“转到定义”时,它显示 string[] 代替 string* [] 并显示 long 代替 long long在函数原型(prototype)中,例如:- 假设在 dll 中函数看起来像-

public void fn(long long a, string* attributeNames[]) {....}

现在在 C# 中-

在将 dll 引用添加到当前 c# 项目之后。在函数名上按 F12,然后在 Meta Data 中显示以下函数原型(prototype)-

public void fn(long a, string[] attributeNames);

此 dll 是包含托管和非托管代码的包装器。
提前致谢。

最佳答案

C++ 被转换为 IL,后者在元数据中被转换为 C#。

您不需要在 C# 中显式定义指针,引用类型是隐式指针。这就是为什么 string* attributeNames[] 转换为 string[] attributeNames

long long 在 C++ 中是一个 64 位整数,在 C# 中是 long

关于c# - c++ 中的 string* [] 转换为 c# 中的 string[],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31774273/

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