The core library API for plc_tag_get_raw_bytes allows the caller to provide their own buffer for the method to fill.
Expose an overload of GetBuffer() that mirrors this behaviour. This will allow the caller to manage to lifetime of that memory, and potentially re-use it when appropriate (preventing garbage collection).
The key use-case for this is when taking a hash of the buffer, and using it for change detection. In this situation you do not need to keep multiple copies of the buffer, and a single buffer could be re-used between calls.
The core library API for
plc_tag_get_raw_bytes
allows the caller to provide their own buffer for the method to fill.Expose an overload of
GetBuffer()
that mirrors this behaviour. This will allow the caller to manage to lifetime of that memory, and potentially re-use it when appropriate (preventing garbage collection).The key use-case for this is when taking a hash of the buffer, and using it for change detection. In this situation you do not need to keep multiple copies of the buffer, and a single buffer could be re-used between calls.