Class UnknownFieldSet (3.23.0)

public sealed class UnknownFieldSet

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.

Inheritance

object > UnknownFieldSet

Namespace

Google.Protobuf

Assembly

Google.Protobuf.dll

Methods

CalculateSize()

public int CalculateSize()

Gets the number of bytes required to encode this set.

Returns
TypeDescription
int

Clone(UnknownFieldSet)

public static UnknownFieldSet Clone(UnknownFieldSet other)

Clone an unknown field set from other.

Parameter
NameDescription
otherUnknownFieldSet
Returns
TypeDescription
UnknownFieldSet

Equals(object)

public override bool Equals(object other)

Checks if two unknown field sets are equal.

Parameter
NameDescription
otherobject
Returns
TypeDescription
bool
Overrides

GetHashCode()

public override int GetHashCode()

Gets the unknown field set's hash code.

Returns
TypeDescription
int
Overrides

MergeFieldFrom(UnknownFieldSet, CodedInputStream)

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.

Parameters
NameDescription
unknownFieldsUnknownFieldSet

The UnknownFieldSet which need to be merged

inputCodedInputStream

The coded input stream containing the field

Returns
TypeDescription
UnknownFieldSet

The merged UnknownFieldSet

MergeFieldFrom(UnknownFieldSet, ref ParseContext)

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.

Parameters
NameDescription
unknownFieldsUnknownFieldSet

The UnknownFieldSet which need to be merged

ctxParseContext

The parse context from which to read the field

Returns
TypeDescription
UnknownFieldSet

The merged UnknownFieldSet

MergeFrom(UnknownFieldSet, UnknownFieldSet)

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.

Parameters
NameDescription
unknownFieldsUnknownFieldSet
otherUnknownFieldSet
Returns
TypeDescription
UnknownFieldSet

WriteTo(CodedOutputStream)

public void WriteTo(CodedOutputStream output)

Serializes the set and writes it to output.

Parameter
NameDescription
outputCodedOutputStream

WriteTo(ref WriteContext)

public void WriteTo(ref WriteContext ctx)

Serializes the set and writes it to ctx.

Parameter
NameDescription
ctxWriteContext