diff options
Diffstat (limited to 'csharp')
-rw-r--r-- | csharp/src/Google.Protobuf/JsonParser.cs | 17 |
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); } } } |