aboutsummaryrefslogtreecommitdiff
path: root/src/AddressBook
diff options
context:
space:
mode:
authorcsharptest <roger@csharptest.net>2011-06-03 11:57:47 -0500
committerrogerk <devnull@localhost>2011-06-03 11:57:47 -0500
commit90922db77aef8bd7f21e7a87a75d86885da8dbbc (patch)
treeb86202690d68a01341c2232477657a4da27f7375 /src/AddressBook
parent8a2d0f48d70bd760bf26218f7107c86ca9f91cce (diff)
downloadprotobuf-90922db77aef8bd7f21e7a87a75d86885da8dbbc.tar.gz
protobuf-90922db77aef8bd7f21e7a87a75d86885da8dbbc.tar.bz2
protobuf-90922db77aef8bd7f21e7a87a75d86885da8dbbc.zip
Added the field name to all CodedOutputStream.Write??? calls
Refactored 'speed' generated write of arrays to call Write???Array. This may have impacted speed write speeds for arrays of non-reference types due to the use of non-generic IEnumerable and the subsequent boxing of value types. This could be addressed later if desired.
Diffstat (limited to 'src/AddressBook')
-rw-r--r--src/AddressBook/AddressBookProtos.cs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/AddressBook/AddressBookProtos.cs b/src/AddressBook/AddressBookProtos.cs
index 38029ac6..8b4ac021 100644
--- a/src/AddressBook/AddressBookProtos.cs
+++ b/src/AddressBook/AddressBookProtos.cs
@@ -155,10 +155,10 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasNumber) {
- output.WriteString(1, Number);
+ output.WriteString(1, "number", Number);
}
if (HasType) {
- output.WriteEnum(2, (int) Type);
+ output.WriteEnum(2, "type", (int) Type, Type.ToString());
}
UnknownFields.WriteTo(output);
}
@@ -431,16 +431,16 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
if (HasName) {
- output.WriteString(1, Name);
+ output.WriteString(1, "name", Name);
}
if (HasId) {
- output.WriteInt32(2, Id);
+ output.WriteInt32(2, "id", Id);
}
if (HasEmail) {
- output.WriteString(3, Email);
+ output.WriteString(3, "email", Email);
}
- foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber element in PhoneList) {
- output.WriteMessage(4, element);
+ if (phone_.Count > 0) {
+ output.WriteMessageArray(4, "phone", phone_);
}
UnknownFields.WriteTo(output);
}
@@ -774,8 +774,8 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
public override void WriteTo(pb::CodedOutputStream output) {
int size = SerializedSize;
- foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in PersonList) {
- output.WriteMessage(1, element);
+ if (person_.Count > 0) {
+ output.WriteMessageArray(1, "person", person_);
}
UnknownFields.WriteTo(output);
}