Class Option (3.23.0)

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

A protocol buffer option, which can be attached to a message, field, enumeration, etc.

Inheritance

object > Option

Namespace

Google.Protobuf.WellKnownTypes

Assembly

Google.Protobuf.dll

Constructors

Option()

public Option()

Option(Option)

public Option(Option other)
Parameter
NameDescription
otherOption

Fields

NameFieldNumber

public const int NameFieldNumber = 1

Field number for the "name" field.

Field Value
TypeDescription
int

ValueFieldNumber

public const int ValueFieldNumber = 2

Field number for the "value" field.

Field Value
TypeDescription
int

Properties

Descriptor

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

Name

public string Name { get; set; }

The option's name. For protobuf built-in options (options defined in descriptor.proto), this is the short name. For example, "map_entry". For custom options, it should be the fully-qualified name. For example, "google.api.http".

Property Value
TypeDescription
string

Parser

public static MessageParser<Option> Parser { get; }
Property Value
TypeDescription
MessageParserOption

Value

public Any Value { get; set; }

The option's value packed in an Any message. If the value is a primitive, the corresponding wrapper type defined in google/protobuf/wrappers.proto should be used. If the value is an enum, it should be stored as an int32 value using the google.protobuf.Int32Value type.

Property Value
TypeDescription
Any

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 Option Clone()

Creates a deep clone of this object.

Returns
TypeDescription
Option

A deep clone of this object.

Equals(Option)

public bool Equals(Option other)
Parameter
NameDescription
otherOption
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(Option)

public void MergeFrom(Option other)

Merges the given message into this one.

Parameter
NameDescription
otherOption
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