|
|
|
@ -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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|