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
NameDescription
otherMessageOptions

Fields

DeprecatedFieldNumber

public const int DeprecatedFieldNumber = null

Field number for the "deprecated" field.

Field Value
TypeDescription
Int32

MapEntryFieldNumber

public const int MapEntryFieldNumber = null

Field number for the "map_entry" field.

Field Value
TypeDescription
Int32

MessageSetWireFormatFieldNumber

public const int MessageSetWireFormatFieldNumber = null

Field number for the "message_set_wire_format" field.

Field Value
TypeDescription
Int32

NoStandardDescriptorAccessorFieldNumber

public const int NoStandardDescriptorAccessorFieldNumber = null

Field number for the "no_standard_descriptor_accessor" field.

Field Value
TypeDescription
Int32

UninterpretedOptionFieldNumber

public const int UninterpretedOptionFieldNumber = null

Field number for the "uninterpreted_option" field.

Field Value
TypeDescription
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
TypeDescription
Boolean

Descriptor

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

HasDeprecated

public bool HasDeprecated { get; }

Gets whether the "deprecated" field is set

Property Value
TypeDescription
Boolean

HasMapEntry

public bool HasMapEntry { get; }

Gets whether the "map_entry" field is set

Property Value
TypeDescription
Boolean

HasMessageSetWireFormat

public bool HasMessageSetWireFormat { get; }

Gets whether the "message_set_wire_format" field is set

Property Value
TypeDescription
Boolean

HasNoStandardDescriptorAccessor

public bool HasNoStandardDescriptorAccessor { get; }

Gets whether the "no_standard_descriptor_accessor" field is set

Property Value
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
Boolean

Parser

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

UninterpretedOption

public RepeatedField<UninterpretedOption> UninterpretedOption { get; }

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

Property Value
TypeDescription
RepeatedField<UninterpretedOption>

Methods

CalculateSize()

public int CalculateSize()
Returns
TypeDescription
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
NameDescription
extensionExtension<MessageOptions, TValue>
Type Parameter
NameDescription
TValue

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

public void ClearExtension<TValue>(RepeatedExtension<MessageOptions, TValue> extension)
Parameter
NameDescription
extensionRepeatedExtension<MessageOptions, TValue>
Type Parameter
NameDescription
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
TypeDescription
MessageOptions

Equals(MessageOptions)

public bool Equals(MessageOptions other)
Parameter
NameDescription
otherMessageOptions
Returns
TypeDescription
Boolean

Equals(Object)

public override bool Equals(object other)
Parameter
NameDescription
otherObject
Returns
TypeDescription
Boolean

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

public TValue GetExtension<TValue>(Extension<MessageOptions, TValue> extension)
Parameter
NameDescription
extensionExtension<MessageOptions, TValue>
Returns
TypeDescription
TValue
Type Parameter
NameDescription
TValue

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

public RepeatedField<TValue> GetExtension<TValue>(RepeatedExtension<MessageOptions, TValue> extension)
Parameter
NameDescription
extensionRepeatedExtension<MessageOptions, TValue>
Returns
TypeDescription
RepeatedField<TValue>
Type Parameter
NameDescription
TValue

GetHashCode()

public override int GetHashCode()
Returns
TypeDescription
Int32

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

public RepeatedField<TValue> GetOrInitializeExtension<TValue>(RepeatedExtension<MessageOptions, TValue> extension)
Parameter
NameDescription
extensionRepeatedExtension<MessageOptions, TValue>
Returns
TypeDescription
RepeatedField<TValue>
Type Parameter
NameDescription
TValue

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

public bool HasExtension<TValue>(Extension<MessageOptions, TValue> extension)
Parameter
NameDescription
extensionExtension<MessageOptions, TValue>
Returns
TypeDescription
Boolean
Type Parameter
NameDescription
TValue

MergeFrom(CodedInputStream)

public void MergeFrom(CodedInputStream input)
Parameter
NameDescription
inputCodedInputStream

MergeFrom(MessageOptions)

public void MergeFrom(MessageOptions other)
Parameter
NameDescription
otherMessageOptions

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

public void SetExtension<TValue>(Extension<MessageOptions, TValue> extension, TValue value)
Parameters
NameDescription
extensionExtension<MessageOptions, TValue>
valueTValue
Type Parameter
NameDescription
TValue

ToString()

public override string ToString()
Returns
TypeDescription
String

WriteTo(CodedOutputStream)

public void WriteTo(CodedOutputStream output)
Parameter
NameDescription
outputCodedOutputStream

Explicit Interface Implementations

IBufferMessage.InternalMergeFrom(ref ParseContext)

void IBufferMessage.InternalMergeFrom(ref ParseContext input)
Parameter
NameDescription
inputParseContext

IBufferMessage.InternalWriteTo(ref WriteContext)

void IBufferMessage.InternalWriteTo(ref WriteContext output)
Parameter
NameDescription
outputWriteContext

IMessage.Descriptor

MessageDescriptor IMessage.Descriptor { get; }
Returns
TypeDescription
MessageDescriptor