Google.Protobuf.Collections.MapField< TKey, TValue >

Summary

Key type in the map. Must be a type supported by Protocol Buffer map keys.

TValue

Value type in the map. Must be a type supported by Protocol Buffers.

For string keys, the equality comparison is provided by StringComparer.Ordinal.

Null values are not permitted in the map, either for wrapper types or regular messages. If a map is deserialized from a data stream and the value is missing from an entry, a default value is created instead. For primitive types, that is the regular default value (0, the empty string and so on); for message types, an empty instance of the message is created, as if the map entry contained a 0-length encoded value for the field.

This implementation does not generally prohibit the use of key/value types which are not supported by Protocol Buffers (e.g. using a key type of

byte

) but nor does it guarantee that all operations will work in such cases.

The order in which entries are returned when iterating over this object is undefined, and may change in future versions.

AddEntriesFrom

It is assumed that the stream is initially positioned after the tag specified by the codec. This method will continue reading entries from the stream until the end is reached, or a different tag is encountered.