Used to keep track of fields which were seen when parsing a protocol message
but whose field numbers or types are unrecognized. This most frequently
occurs when new fields are added to a message type and then messages containing
those fields are read by old software that was built before the new types were
added.
Most users will never need to use this class directly.
public static UnknownFieldSet MergeFieldFrom(UnknownFieldSet unknownFields, CodedInputStream input)
Create a new UnknownFieldSet if unknownFields is null.
Parse a single field from input and merge it
into unknownFields. If input is configured to discard unknown fields,
unknownFields will be returned as-is and the field will be skipped.
public static UnknownFieldSet MergeFieldFrom(UnknownFieldSet unknownFields, ref ParseContext ctx)
Create a new UnknownFieldSet if unknownFields is null.
Parse a single field from ctx and merge it
into unknownFields. If ctx is configured to discard unknown fields,
unknownFields will be returned as-is and the field will be skipped.
public static UnknownFieldSet MergeFrom(UnknownFieldSet unknownFields, UnknownFieldSet other)
Created a new UnknownFieldSet to unknownFields if
needed and merges the fields from other into the first set.
If a field number exists in both sets, the values in other
will be appended to the values in this set.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003e\u003ccode\u003eUnknownFieldSet\u003c/code\u003e is used to track unrecognized fields encountered when parsing protocol messages, often occurring when new fields are added to a message type and older software reads them.\u003c/p\u003e\n"],["\u003cp\u003eMost users will not need to interact directly with the \u003ccode\u003eUnknownFieldSet\u003c/code\u003e class.\u003c/p\u003e\n"],["\u003cp\u003eThe class includes methods for calculating the size of the set, cloning it, checking for equality, getting a hash code, and merging or writing the unknown fields.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of \u003ccode\u003eUnknownFieldSet\u003c/code\u003e is 3.27.1, but the documentation also covers versions 3.23.0 and 3.15.8.\u003c/p\u003e\n"]]],[],null,["# Class UnknownFieldSet (3.27.1)\n\nVersion latestkeyboard_arrow_down\n\n- [3.27.1 (latest)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.UnknownFieldSet)\n- [3.23.0](/dotnet/docs/reference/Google.Protobuf/3.23.0/Google.Protobuf.UnknownFieldSet)\n- [3.15.8](/dotnet/docs/reference/Google.Protobuf/3.15.8/Google.Protobuf.UnknownFieldSet) \n\n public sealed class UnknownFieldSet\n\nUsed to keep track of fields which were seen when parsing a protocol message\nbut whose field numbers or types are unrecognized. This most frequently\noccurs when new fields are added to a message type and then messages containing\nthose fields are read by old software that was built before the new types were\nadded.\n\nMost users will never need to use this class directly. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e UnknownFieldSet \n\nInherited Members\n-----------------\n\n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Protobuf](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf)\n\nAssembly\n--------\n\nGoogle.Protobuf.dll\n\nMethods\n-------\n\n### CalculateSize()\n\n public int CalculateSize()\n\nGets the number of bytes required to encode this set.\n\n### Clone(UnknownFieldSet)\n\n public static UnknownFieldSet Clone(UnknownFieldSet other)\n\nClone an unknown field set from `other`.\n\n### Equals(object)\n\n public override bool Equals(object other)\n\nChecks if two unknown field sets are equal.\n\n**Overrides** \n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object))\n\n### GetHashCode()\n\n public override int GetHashCode()\n\nGets the unknown field set's hash code.\n\n**Overrides** \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)\n\n### MergeFieldFrom(UnknownFieldSet, CodedInputStream)\n\n public static UnknownFieldSet MergeFieldFrom(UnknownFieldSet unknownFields, CodedInputStream input)\n\nCreate a new UnknownFieldSet if unknownFields is null.\nParse a single field from `input` and merge it\ninto unknownFields. If `input` is configured to discard unknown fields,\n`unknownFields` will be returned as-is and the field will be skipped.\n\n### MergeFieldFrom(UnknownFieldSet, ref ParseContext)\n\n public static UnknownFieldSet MergeFieldFrom(UnknownFieldSet unknownFields, ref ParseContext ctx)\n\nCreate a new UnknownFieldSet if unknownFields is null.\nParse a single field from `ctx` and merge it\ninto unknownFields. If `ctx` is configured to discard unknown fields,\n`unknownFields` will be returned as-is and the field will be skipped.\n\n### MergeFrom(UnknownFieldSet, UnknownFieldSet)\n\n public static UnknownFieldSet MergeFrom(UnknownFieldSet unknownFields, UnknownFieldSet other)\n\nCreated a new UnknownFieldSet to `unknownFields` if\nneeded and merges the fields from `other` into the first set.\nIf a field number exists in both sets, the values in `other`\nwill be appended to the values in this set.\n\n### WriteTo(CodedOutputStream)\n\n public void WriteTo(CodedOutputStream output)\n\nSerializes the set and writes it to `output`.\n\n### WriteTo(ref WriteContext)\n\n public void WriteTo(ref WriteContext ctx)\n\nSerializes the set and writes it to `ctx`."]]