What is the best way in vb.net to let MessagePack for C# Deserialize from a specific position in byte array?

39 Views Asked by At

I am trying to use MessagePack for C# in a .NET Framework VB.NET project.

If I have a Byte array, what is the best way to get the Deserialize function of the library to read from a specific point in a byte array?

Unfortunately the docs are written for C#, have tried some things but cannot really find an argument to pass to deserialize for this from vb.net (using the generic functions, Of T)

I want to avoid creating potentially unsafe "As Memory" or "ReadOnlySequence" objects or copy to a new byte array, if I could avoid this.

Is there a safe "view" of a section of a byte array, that prevents the byte array from being garbage collected while this view exists? Or is there a way to pass an argument to MessagePack Deserialize to let it read from a certain position?

I did ask GPT-4 in quite a few ways, but it did not come up with a good solution, and produced some valid and invalid code as examples.

Thank you for sharing your insights!

0

There are 0 best solutions below