<PackageReference Include="Google.Protobuf" Version="3.35.1" />

Google.Protobuf.MessageParser

public class MessageParser
A general message parser, typically used by reflection-based code as all the methods return simple IMessage.

Parses a length-delimited message from the given stream.

public IMessage ParseFrom(byte[] data)

Parses a message from a byte array.

public IMessage ParseFrom(byte[] data, int offset, int length)

Parses a message from a byte array slice.

Parses a message from the given byte string.

public IMessage ParseFrom(Stream input)

Parses a message from the given stream.

public IMessage ParseFrom(ReadOnlySequence<byte> data)

Parses a message from the given sequence.

public IMessage ParseFrom(ReadOnlySpan<byte> data)

Parses a message from the given span.

Parses a message from the given coded input stream.

public IMessage ParseJson(string json)

Parses a message from the given JSON.

public MessageParser WithDiscardUnknownFields(bool discardUnknownFields)

Creates a new message parser which optionally discards unknown fields when parsing.

Creates a new message parser which registers extensions from the specified registry upon creating the message instance