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

Google.Protobuf.MessageParser<T>

public sealed class MessageParser<T> : MessageParser where T : IMessage<T>
A parser for a specific message type.
public MessageParser(Func<T> factory)

Creates a new parser.

public T ParseDelimitedFrom(Stream input)

Parses a length-delimited message from the given stream.

public T ParseFrom(byte[] data)

Parses a message from a byte array.

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

Parses a message from a byte array slice.

public T ParseFrom(ByteString data)

Parses a message from the given byte string.

public T ParseFrom(Stream input)

Parses a message from the given stream.

public T ParseFrom(ReadOnlySequence<byte> data)

Parses a message from the given sequence.

public T ParseFrom(ReadOnlySpan<byte> data)

Parses a message from the given span.

public T ParseFrom(CodedInputStream input)

Parses a message from the given coded input stream.

public T ParseJson(string json)

Parses a message from the given JSON.

public MessageParser<T> 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