diff options
Diffstat (limited to 'csharp/src/Google.Protobuf')
4 files changed, 18 insertions, 31 deletions
diff --git a/csharp/src/Google.Protobuf/Collections/MapField.cs b/csharp/src/Google.Protobuf/Collections/MapField.cs index 993a89d7..053f7558 100644 --- a/csharp/src/Google.Protobuf/Collections/MapField.cs +++ b/csharp/src/Google.Protobuf/Collections/MapField.cs @@ -48,9 +48,6 @@ namespace Google.Protobuf.Collections /// <typeparam name="TValue">Value type in the map. Must be a type supported by Protocol Buffers.</typeparam> /// <remarks> /// <para> - /// This implementation preserves insertion order for simplicity of testing - /// code using maps fields. Overwriting an existing entry does not change the - /// position of that entry within the map. Equality is not order-sensitive. /// For string keys, the equality comparison is provided by <see cref="StringComparer.Ordinal" />. /// </para> /// <para> @@ -65,6 +62,10 @@ namespace Google.Protobuf.Collections /// supported by Protocol Buffers (e.g. using a key type of <code>byte</code>) but nor does it guarantee /// that all operations will work in such cases. /// </para> + /// <para> + /// The order in which entries are returned when iterating over this object is undefined, and may change + /// in future versions. + /// </para> /// </remarks> public sealed class MapField<TKey, TValue> : IDeepCloneable<MapField<TKey, TValue>>, IDictionary<TKey, TValue>, IEquatable<MapField<TKey, TValue>>, IDictionary { diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.nuspec b/csharp/src/Google.Protobuf/Google.Protobuf.nuspec index 2892b8bf..90e3da3d 100644 --- a/csharp/src/Google.Protobuf/Google.Protobuf.nuspec +++ b/csharp/src/Google.Protobuf/Google.Protobuf.nuspec @@ -5,7 +5,7 @@ <title>Google Protocol Buffers C#</title> <summary>C# runtime library for Protocol Buffers - Google's data interchange format.</summary> <description>See project site for more info.</description> - <version>3.0.0-beta2</version> + <version>3.0.0-beta3</version> <authors>Google Inc.</authors> <owners>protobuf-packages</owners> <licenseUrl>https://github.com/google/protobuf/blob/master/LICENSE</licenseUrl> @@ -51,4 +51,4 @@ <file src="bin/ReleaseSigned/Google.Protobuf.xml" target="lib/dotnet" /> <file src="**\*.cs" target="src" /> </files> -</package>
\ No newline at end of file +</package> diff --git a/csharp/src/Google.Protobuf/JsonFormatter.cs b/csharp/src/Google.Protobuf/JsonFormatter.cs index 83772473..2aa98cd1 100644 --- a/csharp/src/Google.Protobuf/JsonFormatter.cs +++ b/csharp/src/Google.Protobuf/JsonFormatter.cs @@ -377,8 +377,16 @@ namespace Google.Protobuf throw new ArgumentException("Invalid field type"); } } - - private void WriteValue(TextWriter writer, object value) + + /// <summary> + /// Writes a single value to the given writer as JSON. Only types understood by + /// Protocol Buffers can be written in this way. This method is only exposed for + /// advanced use cases; most users should be using <see cref="Format(IMessage)"/> + /// or <see cref="Format(IMessage, TextWriter)"/>. + /// </summary> + /// <param name="writer">The writer to write the value to. Must not be null.</param> + /// <param name="value">The value to write. May be null.</param> + public void WriteValue(TextWriter writer, object value) { if (value == null) { @@ -447,15 +455,7 @@ namespace Google.Protobuf } else if (value is IMessage) { - IMessage message = (IMessage) value; - if (message.Descriptor.IsWellKnownType) - { - WriteWellKnownTypeValue(writer, message.Descriptor, value); - } - else - { - WriteMessage(writer, (IMessage)value); - } + Format((IMessage)value, writer); } else { @@ -724,20 +724,6 @@ namespace Google.Protobuf } /// <summary> - /// Returns whether or not a singular value can be represented in JSON. - /// Currently only relevant for enums, where unknown values can't be represented. - /// For repeated/map fields, this always returns true. - /// </summary> - private bool CanWriteSingleValue(object value) - { - if (value is System.Enum) - { - return System.Enum.IsDefined(value.GetType(), value); - } - return true; - } - - /// <summary> /// Writes a string (including leading and trailing double quotes) to a builder, escaping as required. /// </summary> /// <remarks> diff --git a/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs b/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs index 225ac0dd..0516f18e 100644 --- a/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs +++ b/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs @@ -64,4 +64,4 @@ using System.Security; [assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
-[assembly: AssemblyInformationalVersion("3.0.0-alpha4")]
+[assembly: AssemblyInformationalVersion("3.0.0-beta3")]
|