I have an unsafe byte* pointing to a native byte array of known length. How can I convert it to byte[]?
An unsafe sbyte* pointing to a zero-terminated native string can be converted to a C# string easily, because there is a conversion constructor for this purpose, but I can't find a simple way to convert byte* to byte[].
byte[]beconst byte*by default? so try indexing the pointer as*(myByte+index);But i guess it if were that easy you wouldn't be asking....*(myByte+index)asmyByte[index]. No conversion necessary.byte[]or not?