aboutsummaryrefslogtreecommitdiff
path: root/src/ProtocolBuffers/FieldSet.cs
diff options
context:
space:
mode:
authorcsharptest <roger@csharptest.net>2011-10-01 08:32:40 -0500
committerrogerk <devnull@localhost>2011-10-01 08:32:40 -0500
commitb868afac7cd6fce9b59e852cda8c418550911186 (patch)
tree8cb420b495c0b6ad9a1a7fb4e9e7863749231d6d /src/ProtocolBuffers/FieldSet.cs
parent8601fc98a4af98dde3917b9cea8d73f5025e35e6 (diff)
downloadprotobuf-b868afac7cd6fce9b59e852cda8c418550911186.tar.gz
protobuf-b868afac7cd6fce9b59e852cda8c418550911186.tar.bz2
protobuf-b868afac7cd6fce9b59e852cda8c418550911186.zip
Backed out changeset: 47878e59489c
Diffstat (limited to 'src/ProtocolBuffers/FieldSet.cs')
-rw-r--r--src/ProtocolBuffers/FieldSet.cs20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/ProtocolBuffers/FieldSet.cs b/src/ProtocolBuffers/FieldSet.cs
index 27699771..f3c08cf5 100644
--- a/src/ProtocolBuffers/FieldSet.cs
+++ b/src/ProtocolBuffers/FieldSet.cs
@@ -87,12 +87,8 @@ namespace Google.ProtocolBuffers
public static FieldSet CreateInstance()
{
-#if SILVERLIGHT2
- return new FieldSet(new Dictionary<IFieldDescriptorLite, object>());
-#else
// Use SortedList to keep fields in the canonical order
return new FieldSet(new SortedList<IFieldDescriptorLite, object>());
-#endif
}
/// <summary>
@@ -313,16 +309,7 @@ namespace Google.ProtocolBuffers
/// </summary>
internal IEnumerator<KeyValuePair<IFieldDescriptorLite, object>> GetEnumerator()
{
-#if SILVERLIGHT2
- List<KeyValuePair<IFieldDescriptorLite, object>> result = new List<KeyValuePair<IFieldDescriptorLite, object>>(fields);
- result.Sort(
- delegate(KeyValuePair<IFieldDescriptorLite, object> a, KeyValuePair<IFieldDescriptorLite, object> b)
- { return a.Key.CompareTo(b.Key); }
- );
- return result.GetEnumerator();
-#else
return fields.GetEnumerator();
-#endif
}
/// <summary>
@@ -474,12 +461,9 @@ namespace Google.ProtocolBuffers
/// </summary>
public void WriteTo(ICodedOutputStream output)
{
- using (IEnumerator<KeyValuePair<IFieldDescriptorLite, object>> e = GetEnumerator())
+ foreach (KeyValuePair<IFieldDescriptorLite, object> entry in fields)
{
- while (e.MoveNext())
- {
- WriteField(e.Current.Key, e.Current.Value, output);
- }
+ WriteField(entry.Key, entry.Value, output);
}
}