fixed arrays

  • Thread starter Thread starter leibnizster
  • Start date Start date
L

leibnizster

Hello



I have a c++ unmanaged struct that has as one of its components an
array of constant length. To transform it in managed array I have to
use something like:

public struct blabla
{
....
fixed public char fixedArray[10];
....
}

when I use the struct, it is clear that fixedArray is of type char*.
The question is if i can use somehow fixedArray as an array, without
the pointer logic.

Thanks
 
The question is if i can use somehow fixedArray as an array, without
the pointer logic.

No you can't, it's not a real array. But perhaps you can change your
struct to

public struct blabla
{
....
[MarshalAs(UnmanagedType.ByValArray, SizeConst=10)]
public char[] fixedArray;
....
}


Mattias
 
Back
Top