Class MessageOptions (3.15.8)

public sealed class MessageOptions : object, IExtendableMessage<MessageOptions>, IMessage<MessageOptions>, IEquatable<MessageOptions>, IDeepCloneable<MessageOptions>, IBufferMessage, IMessage

Inheritance

Object > MessageOptions

Namespace

Google.Protobuf.Reflection

Assembly

Google.Protobuf.dll

Constructors

MessageOptions()

public MessageOptions()

MessageOptions(MessageOptions)

public MessageOptions(MessageOptions other)
Parameter
Name Description
other MessageOptions

Fields

DeprecatedFieldNumber

public const int DeprecatedFieldNumber = null

Field number for the "deprecated" field.

Field Value
Type Description
Int32

MapEntryFieldNumber

public const int MapEntryFieldNumber = null

Field number for the "map_entry" field.

Field Value
Type Description
Int32

MessageSetWireFormatFieldNumber

public const int MessageSetWireFormatFieldNumber = null

Field number for the "message_set_wire_format" field.

Field Value
Type Description
Int32

NoStandardDescriptorAccessorFieldNumber

public const int NoStandardDescriptorAccessorFieldNumber = null

Field number for the "no_standard_descriptor_accessor" field.

Field Value
Type Description
Int32

UninterpretedOptionFieldNumber

public const int UninterpretedOptionFieldNumber = null

Field number for the "uninterpreted_option" field.

Field Value
Type Description
Int32

Properties

Deprecated

public bool Deprecated { get; set; }

Is this message deprecated? Depending on the target platform, this can emit Deprecated annotations for the message, or it will be completely ignored; in the very least, this is a formalization for deprecating messages.

Property Value
Type Description
Boolean

Descriptor

public static MessageDescriptor Descriptor { get; }
Property Value
Type Description
MessageDescriptor

HasDeprecated

public bool HasDeprecated { get; }

Gets whether the "deprecated" field is set

Property Value
Type Description
Boolean

HasMapEntry

public bool HasMapEntry { get; }

Gets whether the "map_entry" field is set

Property Value
Type Description
Boolean

HasMessageSetWireFormat

public bool HasMessageSetWireFormat { get; }

Gets whether the "message_set_wire_format" field is set

Property Value
Type Description
Boolean

HasNoStandardDescriptorAccessor

public bool HasNoStandardDescriptorAccessor { get; }

Gets whether the "no_standard_descriptor_accessor" field is set

Property Value
Type Description
Boolean

MapEntry

public bool MapEntry { get; set; }

Whether the message is an automatically generated map entry type for the maps field.

For maps fields: map<KeyType, ValueType> map_field = 1; The parsed descriptor looks like: message MapFieldEntry { option map_entry = true; optional KeyType key = 1; optional ValueType value = 2; } repeated MapFieldEntry map_field = 1;

Implementations may choose not to generate the map_entry=true message, but use a native map in the target language to hold the keys and values. The reflection APIs in such implementations still need to work as if the field is a repeated message field.

NOTE: Do not set the option in .proto files. Always use the maps syntax instead. The option should only be implicitly set by the proto compiler parser.

Property Value
Type Description
Boolean

MessageSetWireFormat

public bool MessageSetWireFormat { get; set; }

Set true to use the old proto1 MessageSet wire format for extensions. This is provided for backwards-compatibility with the MessageSet wire format. You should not use this for any other reason: It's less efficient, has fewer features, and is more complicated.

The message must be defined exactly as follows: message Foo { option message_set_wire_format = true; extensions 4 to max; } Note that the message cannot have any defined fields; MessageSets only have extensions.

All extensions of your type must be singular messages; e.g. they cannot be int32s, enums, or repeated messages.

Because this is an option, the above two restrictions are not enforced by the protocol compiler.

Property Value
Type Description
Boolean

NoStandardDescriptorAccessor

public bool NoStandardDescriptorAccessor { get; set; }

Disables the generation of the standard "descriptor()" accessor, which can conflict with a field of the same name. This is meant to make migration from proto1 easier; new code should avoid fields named "descriptor".

Property Value
Type Description
Boolean

Parser

public static MessageParser<MessageOptions> Parser { get; }
Property Value
Type Description
MessageParser<MessageOptions>

UninterpretedOption

public RepeatedField<UninterpretedOption> UninterpretedOption { get; }

The parser stores options it doesn't recognize here. See above.

Property Value
Type Description
RepeatedField<UninterpretedOption>

Methods

CalculateSize()

public int CalculateSize()
Returns
Type Description
Int32

ClearDeprecated()

public void ClearDeprecated()

Clears the value of the "deprecated" field

ClearExtension<TValue>(Extension<MessageOptions, TValue>)

public void ClearExtension<TValue>(Extension<MessageOptions, TValue> extension)
Parameter
Name Description
extension Extension<MessageOptions, TValue>
Type Parameter
Name Description
TValue

ClearExtension<TValue>(RepeatedExtension<MessageOptions, TValue>)

public void ClearExtension<TValue>(RepeatedExtension<MessageOptions, TValue> extension)
Parameter
Name Description
extension RepeatedExtension<MessageOptions, TValue>
Type Parameter
Name Description
TValue

ClearMapEntry()

public void ClearMapEntry()

Clears the value of the "map_entry" field

ClearMessageSetWireFormat()

public void ClearMessageSetWireFormat()

Clears the value of the "message_set_wire_format" field

ClearNoStandardDescriptorAccessor()

public void ClearNoStandardDescriptorAccessor()

Clears the value of the "no_standard_descriptor_accessor" field

Clone()

public MessageOptions Clone()
Returns
Type Description
MessageOptions

Equals(MessageOptions)

public bool Equals(MessageOptions other)
Parameter
Name Description
other MessageOptions
Returns
Type Description
Boolean

Equals(Object)

public override bool Equals(object other)
Parameter
Name Description
other Object
Returns
Type Description
Boolean

GetExtension<TValue>(Extension<MessageOptions, TValue>)

public TValue GetExtension<TValue>(Extension<MessageOptions, TValue> extension)
Parameter
Name Description
extension Extension<MessageOptions, TValue>
Returns
Type Description
TValue
Type Parameter
Name Description
TValue

GetExtension<TValue>(RepeatedExtension<MessageOptions, TValue>)

public RepeatedField<TValue> GetExtension<TValue>(RepeatedExtension<MessageOptions, TValue> extension)
Parameter
Name Description
extension RepeatedExtension<MessageOptions, TValue>
Returns
Type Description
RepeatedField<TValue>
Type Parameter
Name Description
TValue

GetHashCode()

public override int GetHashCode()
Returns
Type Description
Int32

GetOrInitializeExtension<TValue>(RepeatedExtension<MessageOptions, TValue>)

public RepeatedField<TValue> GetOrInitializeExtension<TValue>(RepeatedExtension<MessageOptions, TValue> extension)
Parameter
Name Description
extension RepeatedExtension<MessageOptions, TValue>
Returns
Type Description
RepeatedField<TValue>
Type Parameter
Name Description
TValue

HasExtension<TValue>(Extension<MessageOptions, TValue>)

public bool HasExtension<TValue>(Extension<MessageOptions, TValue> extension)
Parameter
Name Description
extension Extension<MessageOptions, TValue>
Returns
Type Description
Boolean
Type Parameter
Name Description
TValue

MergeFrom(CodedInputStream)

public void MergeFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream

MergeFrom(MessageOptions)

public void MergeFrom(MessageOptions other)
Parameter
Name Description
other MessageOptions

SetExtension<TValue>(Extension<MessageOptions, TValue>, TValue)

public void SetExtension<TValue>(Extension<MessageOptions, TValue> extension, TValue value)
Parameters
Name Description
extension Extension<MessageOptions, TValue>
value TValue
Type Parameter
Name Description
TValue

ToString()

public override string ToString()
Returns
Type Description
String

WriteTo(CodedOutputStream)

public void WriteTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream

Explicit Interface Implementations

IBufferMessage.InternalMergeFrom(ref ParseContext)

void IBufferMessage.InternalMergeFrom(ref ParseContext input)
Parameter
Name Description
input ParseContext

IBufferMessage.InternalWriteTo(ref WriteContext)

void IBufferMessage.InternalWriteTo(ref WriteContext output)
Parameter
Name Description
output WriteContext

IMessage.Descriptor

MessageDescriptor IMessage.Descriptor { get; }
Returns
Type Description
MessageDescriptor