Protobuf简单记录
repeated
Repeated fields also have some special methods – if you look at the methods for the repeated phones
field, you'll see that you can
- check the repeated field's
_size
(in other words, how many phone numbers are associated with thisPerson
). - get a specified phone number using its index.
- update an existing phone number at the specified index.
- add another phone number to the message which you can then edit (repeated scalar types have an
add_
that just lets you pass in the new value). - 官网