Class Field (3.15.8)
Note: Some or all of the information on this page might not apply
to Trusted Cloud. For a list of services that are available in
Trusted Cloud, see Services available for
Trusted Cloud .
Version 3.15.8keyboard_arrow_down
public sealed class Field : object, IMessage<Field>, IEquatable<Field>, IDeepCloneable<Field>, IBufferMessage, IMessage
A single field of a message type.
Namespace
Google.Protobuf.WellKnownTypes
Assembly
Google.Protobuf.dll
Constructors
Field()
Field(Field)
public Field(Field other)
Parameter
Name
Description
other
Field
Fields
CardinalityFieldNumber
public const int CardinalityFieldNumber = null
Field number for the "cardinality" field.
Field Value
Type
Description
Int32
DefaultValueFieldNumber
public const int DefaultValueFieldNumber = null
Field number for the "default_value" field.
Field Value
Type
Description
Int32
JsonNameFieldNumber
public const int JsonNameFieldNumber = null
Field number for the "json_name" field.
Field Value
Type
Description
Int32
KindFieldNumber
public const int KindFieldNumber = null
Field number for the "kind" field.
Field Value
Type
Description
Int32
NameFieldNumber
public const int NameFieldNumber = null
Field number for the "name" field.
Field Value
Type
Description
Int32
NumberFieldNumber
public const int NumberFieldNumber = null
Field number for the "number" field.
Field Value
Type
Description
Int32
OneofIndexFieldNumber
public const int OneofIndexFieldNumber = null
Field number for the "oneof_index" field.
Field Value
Type
Description
Int32
OptionsFieldNumber
public const int OptionsFieldNumber = null
Field number for the "options" field.
Field Value
Type
Description
Int32
PackedFieldNumber
public const int PackedFieldNumber = null
Field number for the "packed" field.
Field Value
Type
Description
Int32
TypeUrlFieldNumber
public const int TypeUrlFieldNumber = null
Field number for the "type_url" field.
Field Value
Type
Description
Int32
Properties
Cardinality
public Field.Types.Cardinality Cardinality { get; set; }
DefaultValue
public string DefaultValue { get; set; }
The string value of the default value of this field. Proto2 syntax only.
Property Value
Type
Description
String
Descriptor
public static MessageDescriptor Descriptor { get; }
JsonName
public string JsonName { get; set; }
Property Value
Type
Description
String
Kind
public Field.Types.Kind Kind { get; set; }
Name
public string Name { get; set; }
Property Value
Type
Description
String
Number
public int Number { get; set; }
Property Value
Type
Description
Int32
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
Type
Description
Int32
Options
public RepeatedField<Option> Options { get; }
The protocol buffer options.
Packed
public bool Packed { get; set; }
Whether to use alternative packed wire representation.
Property Value
Type
Description
Boolean
Parser
public static MessageParser<Field> Parser { get; }
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
Type
Description
String
Methods
CalculateSize()
public int CalculateSize()
Returns
Type
Description
Int32
Clone()
Returns
Type
Description
Field
Equals(Field)
public bool Equals(Field other)
Parameter
Name
Description
other
Field
Equals(Object)
public override bool Equals(object other)
Parameter
Name
Description
other
Object
GetHashCode()
public override int GetHashCode()
Returns
Type
Description
Int32
public void MergeFrom(CodedInputStream input)
MergeFrom(Field)
public void MergeFrom(Field other)
Parameter
Name
Description
other
Field
ToString()
public override string ToString()
Returns
Type
Description
String
WriteTo(CodedOutputStream)
public void WriteTo(CodedOutputStream output)
Explicit Interface Implementations
IBufferMessage.InternalMergeFrom(ref ParseContext)
void IBufferMessage.InternalMergeFrom(ref ParseContext input)
IBufferMessage.InternalWriteTo(ref WriteContext)
void IBufferMessage.InternalWriteTo(ref WriteContext output)
IMessage.Descriptor
MessageDescriptor IMessage.Descriptor { get; }
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["This page describes the `Field` class within the `Google.Protobuf.WellKnownTypes` namespace, which represents a single field within a message type."],["The `Field` class inherits from `Object` and implements several interfaces including `IMessage`, `IEquatable\u003cField\u003e`, `IDeepCloneable\u003cField\u003e`, and `IBufferMessage`."],["The `Field` class includes properties such as `Cardinality`, `DefaultValue`, `JsonName`, `Kind`, `Name`, `Number`, `OneofIndex`, `Options`, `Packed`, and `TypeUrl`, defining the characteristics of a message field."],["The class offers constructors for creating new `Field` instances, and provides methods such as `Clone`, `Equals`, `GetHashCode`, `MergeFrom`, `CalculateSize`, `ToString`, and `WriteTo`, along with supporting internal interface methods."],["There are also multiple static int fields, representing the field numbers for each property, used for the serializing and deserializing of the data to a data stream."]]],[]]