You can either use an array Byte()
or List(Of Byte)
, or manipulate memory directly with the System.Runtime.InteropServices.Marshal
class's .AllocHGlobal
method with IntPtr
. Note that VB.NET does not allow for pointer arithmetic like C# does. A common workaround is to use Marshal
to copy memory from an address into a Byte
array, perform the work there, then copy it back to the original address.
But we need more information about your ultimate intent. I want to avoid an "XY Problem".