FileSerializer.DeserializeWithLengthPrefix Method

Applies a protocol-buffer stream to an existing instance (or null), using length-prefixed data.
Protected Function DeserializeWithLengthPrefix( _ 
ByVal stream As Stream, _ 
ByVal objectType As Type, _ 
ByRef bytesRead As Long, _ 
ByRef haveObject As Boolean, _ 
Optional ByVal expectedField As Integer = 1 _ 
) As Object
This language is not supported or no code example is available.
protected object DeserializeWithLengthPrefix( 
Stream stream
Type objectType
out long bytesRead
out bool haveObject
int expectedField = 1 
)
This language is not supported or no code example is available.

Parameters

stream
Stream

The binary stream to apply to the instance (cannot be null/Nothing)

objectType
Type

The type of the object that must be deserialized.

bytesRead
long

Returns the number of bytes consumed by this operation (includes length-prefix overheads and any skipped data).

haveObject
bool

True when an object has been read, otherwise false.

expectedField
int

The tag used as a prefix to each record.

Return Value

object

The updated instance; this may be different to the instance argument if either the original instance was null, or the stream defines a known sub-type of the original instance.

Remarks
 
You can use this method to read an object from a protocol-buffer stream representation. You had to serialize the file header before using this method to guarantee the backward compatibility when reading. The opening and the closing of the stream is delegated to you.

.NET Framework

Supported in: 4.8

In this article

Definition