Commit e8c9ae12 authored by Jon Skeet's avatar Jon Skeet Committed by Jon Skeet

Add parser settings WithXyz methods

parent a9854512
......@@ -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);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment