aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs
diff options
context:
space:
mode:
authorJon Skeet <jonskeet@google.com>2015-07-22 19:57:29 +0100
committerJon Skeet <jonskeet@google.com>2015-07-22 20:13:38 +0100
commitc1c6b2d0d579d863c2ff3709a0053039801f5430 (patch)
tree67df2426209fb564b4a8504fafd1ceaf8481bfdb /csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs
parent5e0cfc9a4796ab449e042098e914ace9a635c0b6 (diff)
downloadprotobuf-c1c6b2d0d579d863c2ff3709a0053039801f5430.tar.gz
protobuf-c1c6b2d0d579d863c2ff3709a0053039801f5430.tar.bz2
protobuf-c1c6b2d0d579d863c2ff3709a0053039801f5430.zip
Implemented Jan's suggestion of FieldCollection, replacing FieldAccessorCollection.
I think Jan was actually suggesting keeping both, but that feels redundant to me. The test diff is misleading here IMO, because I wouldn't expect real code using reflection to use several accessors one after another like this, unless it was within a loop. Evidence to the contrary would be welcome :) This change also incidentally goes part way to fixing the issue of the JSON formatter not writing out the fields in field number order - with this change, it does except for oneofs, which we can fix in a follow-up change. I haven't actually added a test with a message with fields deliberately out of order - I'm happy to do so though. It feels like it would make sense to be in google/src/protobuf, but it's not entirely clear what the rules of engagement are for adding new messages there. (unittest_proto3.proto?)
Diffstat (limited to 'csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs')
-rw-r--r--csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs2
1 files changed, 1 insertions, 1 deletions
diff --git a/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs
index a79d9de4..cd4c5534 100644
--- a/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs
+++ b/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs
@@ -70,7 +70,7 @@ namespace Google.Protobuf.Reflection
internal void CrossLink()
{
List<FieldDescriptor> fieldCollection = new List<FieldDescriptor>();
- foreach (var field in ContainingType.Fields)
+ foreach (var field in ContainingType.Fields.InDeclarationOrder())
{
if (field.ContainingOneof == this)
{