Send feedback
Class Field (3.27.1)
Stay organized with collections
Save and categorize content based on your preferences.
Version latest keyboard_arrow_down
public sealed class Field : 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 = 2
Field number for the "cardinality" field.
Field Value
Type
Description
int
DefaultValueFieldNumber
public const int DefaultValueFieldNumber = 11
Field number for the "default_value" field.
Field Value
Type
Description
int
JsonNameFieldNumber
public const int JsonNameFieldNumber = 10
Field number for the "json_name" field.
Field Value
Type
Description
int
KindFieldNumber
public const int KindFieldNumber = 1
Field number for the "kind" field.
Field Value
Type
Description
int
NameFieldNumber
public const int NameFieldNumber = 4
Field number for the "name" field.
Field Value
Type
Description
int
NumberFieldNumber
public const int NumberFieldNumber = 3
Field number for the "number" field.
Field Value
Type
Description
int
OneofIndexFieldNumber
public const int OneofIndexFieldNumber = 7
Field number for the "oneof_index" field.
Field Value
Type
Description
int
OptionsFieldNumber
public const int OptionsFieldNumber = 9
Field number for the "options" field.
Field Value
Type
Description
int
PackedFieldNumber
public const int PackedFieldNumber = 8
Field number for the "packed" field.
Field Value
Type
Description
int
TypeUrlFieldNumber
public const int TypeUrlFieldNumber = 6
Field number for the "type_url" field.
Field Value
Type
Description
int
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
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
Type
Description
int
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
bool
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()
Calculates the size of this message in Protocol Buffer wire format, in bytes.
Returns
Type
Description
int
The number of bytes required to write this message
to a coded output stream.
Clone()
Creates a deep clone of this object.
Returns
Type
Description
Field
A deep clone of this object.
Equals(Field)
public bool Equals(Field other)
Parameter
Name
Description
other
Field
Returns
Type
Description
bool
Equals(object)
public override bool Equals(object other)
Parameter
Name
Description
other
object
Returns
Type
Description
bool
Overrides
GetHashCode()
public override int GetHashCode()
Returns
Type
Description
int
Overrides
public void MergeFrom(CodedInputStream input)
Merges the data from the specified coded input stream with the current message.
Remarks
MergeFrom(Field)
public void MergeFrom(Field other)
Merges the given message into this one.
Parameter
Name
Description
other
Field
Remarks
ToString()
public override string ToString()
Returns
Type
Description
string
Overrides
WriteTo(CodedOutputStream)
public void WriteTo(CodedOutputStream output)
Writes the data to the given coded output stream.
Parameter
Name
Description
output
CodedOutputStream
Coded output stream to write the data to. Must not be null.
Extension Methods
Send feedback
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 2024-11-26 UTC.
Need to tell us more?
[[["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 2024-11-26 UTC."],[],[]]