diff options
author | Jon Skeet <jonskeet@google.com> | 2018-01-03 09:57:58 +0000 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2018-01-15 02:53:45 -0500 |
commit | 47b7d2c7cadf74ceec90fc5042232819cd0dd557 (patch) | |
tree | 1ca71757c1550c134fa0fd55952b4d0ff63df3ed /csharp/src/Google.Protobuf/CodedInputStream.cs | |
parent | 9f80df026933901883da1d556b38292e14836612 (diff) |
Add DiscardUnknownFields support for C#
By default, unknown fields are preserved when parsing. To discard
them, use a parser configured to do so:
var parser = MyMessage.Parser.WithDiscardUnknownFields(true);
Diffstat (limited to 'csharp/src/Google.Protobuf/CodedInputStream.cs')
-rw-r--r-- | csharp/src/Google.Protobuf/CodedInputStream.cs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf/CodedInputStream.cs b/csharp/src/Google.Protobuf/CodedInputStream.cs index 24d436c0..6bee238f 100644 --- a/csharp/src/Google.Protobuf/CodedInputStream.cs +++ b/csharp/src/Google.Protobuf/CodedInputStream.cs @@ -268,6 +268,11 @@ namespace Google.Protobuf public int RecursionLimit { get { return recursionLimit; } }
/// <summary>
+ /// Internal-only property; when set to true, unknown fields will be discarded while parsing.
+ /// </summary>
+ internal bool DiscardUnknownFields { get; set; }
+
+ /// <summary>
/// Disposes of this instance, potentially closing any underlying stream.
/// </summary>
/// <remarks>
|