本文介绍了这个C结构的C#等价物是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我想知道您是否能帮助我.

我想知道如何编写等效的C#,或编写以下c结构的更好方法.


Hi all, I''m wondering if you could help me.

I want to know how to write the C# equivalent, or a better way of writing of the following c structure.


struct SoftwareLayer
{
  char* swSrcPathsBufferPtr;
  char* utCtrPathsBufferPtr;
  char* swSrcFileNameBufferPtr;
  char* utCtrFileNameBufferPtr;
  unsigned int foo;
  unsigned int bah;
};



我想使用C#中的列表,因此通常C#代码应如下所示:
例如




I want to make use of a List in C#, so typically the C# code should look like something like this:
E.g


public unsafe struct SoftwareLayer
{
  List<string> *swSrcPathBufferPtr;
  List<string> *utCtrPathsBufferPtr;
  List<string> *swStrFileNameBufferPtr;
  List<string> *utCtrFileNameBufferPtr;
  uint foo;
  uint bah;
};</string></string></string></string>



我遇到以下问题:无法获取托管类型(''System.Collections.Generic.List<string></string>'')的地址,获取其大小或声明其指针"

问题:
如何定义一个结构以使其具有指向列表的成员?
非常感谢您的帮助.

此致:)
Rudolf



I''m getting the following problem: "Cannot take the address of, get the size of, or declare a pointer to a managed type (''System.Collections.Generic.List<string></string>'')"

Question:
How would one define a structure to have a member that points to a List?
Your help would be appreciated, thx.

Regards, :)
Rudolf

推荐答案

public struct SoftwareLayer
{
public List<char> swSrcPathBufferPtr;
public List<char> utCtrPathsBufferPtr;
public List<char> swStrFileNameBufferPtr;
public List<char> utCtrFileNameBufferPtr;
public uint foo;
public uint bah;
}


jerem


jerem



这篇关于这个C结构的C#等价物是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 00:24
查看更多