Class Option (3.27.1)

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
Name Description
other Option

Fields

NameFieldNumber

public const int NameFieldNumber = 1

Field number for the "name" field.

Field Value
Type Description
int

ValueFieldNumber

public const int ValueFieldNumber = 2

Field number for the "value" field.

Field Value
Type Description
int

Properties

Descriptor

public static MessageDescriptor Descriptor { get; }
Property Value
Type Description
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
Type Description
string

Parser

public static MessageParser<Option> Parser { get; }
Property Value
Type Description
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
Type Description
Any

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

public Option Clone()

Creates a deep clone of this object.

Returns
Type Description
Option

A deep clone of this object.

Equals(Option)

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

MergeFrom(CodedInputStream)

public void MergeFrom(CodedInputStream input)

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

Parameter
Name Description
input CodedInputStream
Remarks

See the user guide for precise merge semantics.

MergeFrom(Option)

public void MergeFrom(Option other)

Merges the given message into this one.

Parameter
Name Description
other Option
Remarks

See the user guide for precise merge semantics.

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