Class Field (3.23.0)

public sealed class Field : IMessage<Field>, IEquatable<Field>, IDeepCloneable<Field>, IBufferMessage, IMessage

A single field of a message type.

Inheritance

object > Field

Namespace

Google.Protobuf.WellKnownTypes

Assembly

Google.Protobuf.dll

Constructors

Field()

public Field()

Field(Field)

public Field(Field other)
Parameter
NameDescription
otherField

Fields

CardinalityFieldNumber

public const int CardinalityFieldNumber = 2

Field number for the "cardinality" field.

Field Value
TypeDescription
int

DefaultValueFieldNumber

public const int DefaultValueFieldNumber = 11

Field number for the "default_value" field.

Field Value
TypeDescription
int

JsonNameFieldNumber

public const int JsonNameFieldNumber = 10

Field number for the "json_name" field.

Field Value
TypeDescription
int

KindFieldNumber

public const int KindFieldNumber = 1

Field number for the "kind" field.

Field Value
TypeDescription
int

NameFieldNumber

public const int NameFieldNumber = 4

Field number for the "name" field.

Field Value
TypeDescription
int

NumberFieldNumber

public const int NumberFieldNumber = 3

Field number for the "number" field.

Field Value
TypeDescription
int

OneofIndexFieldNumber

public const int OneofIndexFieldNumber = 7

Field number for the "oneof_index" field.

Field Value
TypeDescription
int

OptionsFieldNumber

public const int OptionsFieldNumber = 9

Field number for the "options" field.

Field Value
TypeDescription
int

PackedFieldNumber

public const int PackedFieldNumber = 8

Field number for the "packed" field.

Field Value
TypeDescription
int

TypeUrlFieldNumber

public const int TypeUrlFieldNumber = 6

Field number for the "type_url" field.

Field Value
TypeDescription
int

Properties

Cardinality

public Field.Types.Cardinality Cardinality { get; set; }

The field cardinality.

Property Value
TypeDescription
FieldTypesCardinality

DefaultValue

public string DefaultValue { get; set; }

The string value of the default value of this field. Proto2 syntax only.

Property Value
TypeDescription
string

Descriptor

public static MessageDescriptor Descriptor { get; }
Property Value
TypeDescription
MessageDescriptor

JsonName

public string JsonName { get; set; }

The field JSON name.

Property Value
TypeDescription
string

Kind

public Field.Types.Kind Kind { get; set; }

The field type.

Property Value
TypeDescription
FieldTypesKind

Name

public string Name { get; set; }

The field name.

Property Value
TypeDescription
string

Number

public int Number { get; set; }

The field number.

Property Value
TypeDescription
int

OneofIndex

public int OneofIndex { get; set; }

The index of the field type in Type.oneofs, for message or enumeration types. The first type has index 1; zero means the type is not in the list.

Property Value
TypeDescription
int

Options

public RepeatedField<Option> Options { get; }

The protocol buffer options.

Property Value
TypeDescription
RepeatedFieldOption

Packed

public bool Packed { get; set; }

Whether to use alternative packed wire representation.

Property Value
TypeDescription
bool

Parser

public static MessageParser<Field> Parser { get; }
Property Value
TypeDescription
MessageParserField

TypeUrl

public string TypeUrl { get; set; }

The field type URL, without the scheme, for message or enumeration types. Example: "type.googleapis.com/google.protobuf.Timestamp".

Property Value
TypeDescription
string

Methods

CalculateSize()

public int CalculateSize()

Calculates the size of this message in Protocol Buffer wire format, in bytes.

Returns
TypeDescription
int

The number of bytes required to write this message to a coded output stream.

Clone()

public Field Clone()

Creates a deep clone of this object.

Returns
TypeDescription
Field

A deep clone of this object.

Equals(Field)

public bool Equals(Field other)
Parameter
NameDescription
otherField
Returns
TypeDescription
bool

Equals(object)

public override bool Equals(object other)
Parameter
NameDescription
otherobject
Returns
TypeDescription
bool
Overrides

GetHashCode()

public override int GetHashCode()
Returns
TypeDescription
int
Overrides

MergeFrom(CodedInputStream)

public void MergeFrom(CodedInputStream input)

Merges the data from the specified coded input stream with the current message.

Parameter
NameDescription
inputCodedInputStream
Remarks

See the user guide for precise merge semantics.

MergeFrom(Field)

public void MergeFrom(Field other)

Merges the given message into this one.

Parameter
NameDescription
otherField
Remarks

See the user guide for precise merge semantics.

ToString()

public override string ToString()
Returns
TypeDescription
string
Overrides

WriteTo(CodedOutputStream)

public void WriteTo(CodedOutputStream output)

Writes the data to the given coded output stream.

Parameter
NameDescription
outputCodedOutputStream

Coded output stream to write the data to. Must not be null.

Extension Methods