From 47b7d2c7cadf74ceec90fc5042232819cd0dd557 Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Wed, 3 Jan 2018 09:57:58 +0000 Subject: 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); --- csharp/src/Google.Protobuf/CodedInputStream.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'csharp/src/Google.Protobuf/CodedInputStream.cs') 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 @@ -267,6 +267,11 @@ namespace Google.Protobuf /// public int RecursionLimit { get { return recursionLimit; } } + /// + /// Internal-only property; when set to true, unknown fields will be discarded while parsing. + /// + internal bool DiscardUnknownFields { get; set; } + /// /// Disposes of this instance, potentially closing any underlying stream. /// -- cgit v1.2.3