I want to convert a byte* to a byte[], but I also want to have a reusable function to do this:
byte*
byte[]
public unsafe static T[] Create
As of C# 7.3 this is possible as follows:
public unsafe static T[] Create(T* ptr, int length) where T: unmanaged { T[] array = new T[length]; for (int i = 0; i < length; i++) array[i] = ptr[i]; return array; }