DEV Community

Discussion on: Is it correct or wrongly? struct type* to struct type[] If I create multiple arcs or rectangles?

 
jenseckervogt profile image
Jens Eckervogt

I know that. But It looks simple like that
Simple sample

That is why - I really know like this FreeImage for example:

///
/// Returns a string containing the current version of the library.
///
/// The current version of the library.
public static unsafe string GetVersion() { return PtrToStr(GetVersion_()); }
[DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_GetVersion")]
private static unsafe extern byte* GetVersion_();

From FreeImage's Documentation / API References: Click here!

I hope you understand.

But I have problem with Rectangle* rectangles why does C/C++ have only "*" not "[]".

I hope you understand me. Thanks

Thread Thread
 
katnel20 profile image
Katie Nelson

Here the PtrToStr method does the conversion from the static pointer to a csharp string type. You need to convert that pointer to Rectangle structs to an array in csharp.