aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Skeet <jonskeet@google.com>2017-10-27 20:02:40 +0100
committerJon Skeet <skeet@pobox.com>2017-10-28 07:47:43 +0100
commite8c9ae120985b4b6056762e23fea41b9b68dfa0e (patch)
tree06c4c1b214c915b904f8bb258c054a29087d2fa1
parenta9854512532a42c174e1aa496d4bfe05b04645d0 (diff)
downloadprotobuf-e8c9ae120985b4b6056762e23fea41b9b68dfa0e.tar.gz
protobuf-e8c9ae120985b4b6056762e23fea41b9b68dfa0e.tar.bz2
protobuf-e8c9ae120985b4b6056762e23fea41b9b68dfa0e.zip
Add parser settings WithXyz methods
-rw-r--r--csharp/src/Google.Protobuf/JsonParser.cs17
1 files changed, 17 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf/JsonParser.cs b/csharp/src/Google.Protobuf/JsonParser.cs
index 2ab4a860..3621b0c0 100644
--- a/csharp/src/Google.Protobuf/JsonParser.cs
+++ b/csharp/src/Google.Protobuf/JsonParser.cs
@@ -1037,6 +1037,23 @@ namespace Google.Protobuf
/// <param name="ignoreUnknownFields"><c>true</c> if unknown fields should be ignored when parsing; <c>false</c> to throw an exception.</param>
public Settings WithIgnoreUnknownFields(bool ignoreUnknownFields) =>
new Settings(RecursionLimit, TypeRegistry, ignoreUnknownFields);
+
+ /// <summary>
+ /// Creates a new <see cref="Settings"/> object based on this one, but with the specified recursion limit.
+ /// </summary>
+ /// <param name="recursionLimit">The new recursion limit.</param>
+ public Settings WithRecursionLimit(int recursionLimit) =>
+ new Settings(recursionLimit, TypeRegistry, IgnoreUnknownFields);
+
+ /// <summary>
+ /// Creates a new <see cref="Settings"/> object based on this one, but with the specified type registry.
+ /// </summary>
+ /// <param name="typeRegistry">The new type registry. Must not be null.</param>
+ public Settings WithTypeRegistry(TypeRegistry typeRegistry) =>
+ new Settings(
+ RecursionLimit,
+ ProtoPreconditions.CheckNotNull(typeRegistry, nameof(typeRegistry)),
+ IgnoreUnknownFields);
}
}
}