libplctag.NET icon indicating copy to clipboard operation
libplctag.NET copied to clipboard

Provide overload for `GetBuffer(byte[] buffer)`

Open timyhac opened this issue 3 years ago • 0 comments

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.

timyhac avatar Oct 20 '22 20:10 timyhac