Show / Hide Table of Contents

Class MessageOptions

Inheritance
System.Object
MessageOptions
Implements
IExtendableMessage<MessageOptions>
IMessage<MessageOptions>
IMessage
System.IEquatable<MessageOptions>
IDeepCloneable<MessageOptions>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Google.Protobuf.Reflection
Assembly: Google.Protobuf.dll
Syntax
public sealed class MessageOptions : IExtendableMessage<MessageOptions>, IMessage<MessageOptions>, IMessage, IEquatable<MessageOptions>, IDeepCloneable<MessageOptions>

Constructors

MessageOptions()

Declaration
public MessageOptions()

MessageOptions(MessageOptions)

Declaration
public MessageOptions(MessageOptions other)
Parameters
Type Name Description
MessageOptions other

Fields

DeprecatedFieldNumber

Field number for the "deprecated" field.

Declaration
public const int DeprecatedFieldNumber = 3
Field Value
Type Description
System.Int32

MapEntryFieldNumber

Field number for the "map_entry" field.

Declaration
public const int MapEntryFieldNumber = 7
Field Value
Type Description
System.Int32

MessageSetWireFormatFieldNumber

Field number for the "message_set_wire_format" field.

Declaration
public const int MessageSetWireFormatFieldNumber = 1
Field Value
Type Description
System.Int32

NoStandardDescriptorAccessorFieldNumber

Field number for the "no_standard_descriptor_accessor" field.

Declaration
public const int NoStandardDescriptorAccessorFieldNumber = 2
Field Value
Type Description
System.Int32

UninterpretedOptionFieldNumber

Field number for the "uninterpreted_option" field.

Declaration
public const int UninterpretedOptionFieldNumber = 999
Field Value
Type Description
System.Int32

Properties

Deprecated

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.

Declaration
public bool Deprecated { get; set; }
Property Value
Type Description
System.Boolean

Descriptor

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

HasDeprecated

Gets whether the "deprecated" field is set

Declaration
public bool HasDeprecated { get; }
Property Value
Type Description
System.Boolean

HasMapEntry

Gets whether the "map_entry" field is set

Declaration
public bool HasMapEntry { get; }
Property Value
Type Description
System.Boolean

HasMessageSetWireFormat

Gets whether the "message_set_wire_format" field is set

Declaration
public bool HasMessageSetWireFormat { get; }
Property Value
Type Description
System.Boolean

HasNoStandardDescriptorAccessor

Gets whether the "no_standard_descriptor_accessor" field is set

Declaration
public bool HasNoStandardDescriptorAccessor { get; }
Property Value
Type Description
System.Boolean

MapEntry

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.

Declaration
public bool MapEntry { get; set; }
Property Value
Type Description
System.Boolean

MessageSetWireFormat

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.

Declaration
public bool MessageSetWireFormat { get; set; }
Property Value
Type Description
System.Boolean

NoStandardDescriptorAccessor

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".

Declaration
public bool NoStandardDescriptorAccessor { get; set; }
Property Value
Type Description
System.Boolean

Parser

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

UninterpretedOption

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

Declaration
public RepeatedField<UninterpretedOption> UninterpretedOption { get; }
Property Value
Type Description
RepeatedField<UninterpretedOption>

Methods

CalculateSize()

Declaration
public int CalculateSize()
Returns
Type Description
System.Int32
Implements
IMessage.CalculateSize()

ClearDeprecated()

Clears the value of the "deprecated" field

Declaration
public void ClearDeprecated()

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

Declaration
public void ClearExtension<TValue>(Extension<MessageOptions, TValue> extension)
Parameters
Type Name Description
Extension<MessageOptions, TValue> extension
Type Parameters
Name Description
TValue
Implements
IExtendableMessage<T>.ClearExtension<TValue>(Extension<T, TValue>)

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

Declaration
public void ClearExtension<TValue>(RepeatedExtension<MessageOptions, TValue> extension)
Parameters
Type Name Description
RepeatedExtension<MessageOptions, TValue> extension
Type Parameters
Name Description
TValue
Implements
IExtendableMessage<T>.ClearExtension<TValue>(RepeatedExtension<T, TValue>)

ClearMapEntry()

Clears the value of the "map_entry" field

Declaration
public void ClearMapEntry()

ClearMessageSetWireFormat()

Clears the value of the "message_set_wire_format" field

Declaration
public void ClearMessageSetWireFormat()

ClearNoStandardDescriptorAccessor()

Clears the value of the "no_standard_descriptor_accessor" field

Declaration
public void ClearNoStandardDescriptorAccessor()

Clone()

Declaration
public MessageOptions Clone()
Returns
Type Description
MessageOptions
Implements
IDeepCloneable<T>.Clone()

Equals(MessageOptions)

Declaration
public bool Equals(MessageOptions other)
Parameters
Type Name Description
MessageOptions other
Returns
Type Description
System.Boolean
Implements
System.IEquatable<T>.Equals(T)

Equals(Object)

Declaration
public override bool Equals(object other)
Parameters
Type Name Description
System.Object other
Returns
Type Description
System.Boolean
Overrides
System.Object.Equals(System.Object)

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

Declaration
public TValue GetExtension<TValue>(Extension<MessageOptions, TValue> extension)
Parameters
Type Name Description
Extension<MessageOptions, TValue> extension
Returns
Type Description
TValue
Type Parameters
Name Description
TValue
Implements
IExtendableMessage<T>.GetExtension<TValue>(Extension<T, TValue>)

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

Declaration
public RepeatedField<TValue> GetExtension<TValue>(RepeatedExtension<MessageOptions, TValue> extension)
Parameters
Type Name Description
RepeatedExtension<MessageOptions, TValue> extension
Returns
Type Description
RepeatedField<TValue>
Type Parameters
Name Description
TValue
Implements
IExtendableMessage<T>.GetExtension<TValue>(RepeatedExtension<T, TValue>)

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()

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

Declaration
public RepeatedField<TValue> GetOrInitializeExtension<TValue>(RepeatedExtension<MessageOptions, TValue> extension)
Parameters
Type Name Description
RepeatedExtension<MessageOptions, TValue> extension
Returns
Type Description
RepeatedField<TValue>
Type Parameters
Name Description
TValue
Implements
IExtendableMessage<T>.GetOrInitializeExtension<TValue>(RepeatedExtension<T, TValue>)

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

Declaration
public bool HasExtension<TValue>(Extension<MessageOptions, TValue> extension)
Parameters
Type Name Description
Extension<MessageOptions, TValue> extension
Returns
Type Description
System.Boolean
Type Parameters
Name Description
TValue
Implements
IExtendableMessage<T>.HasExtension<TValue>(Extension<T, TValue>)

MergeFrom(CodedInputStream)

Declaration
public void MergeFrom(CodedInputStream input)
Parameters
Type Name Description
CodedInputStream input
Implements
IMessage.MergeFrom(CodedInputStream)

MergeFrom(MessageOptions)

Declaration
public void MergeFrom(MessageOptions other)
Parameters
Type Name Description
MessageOptions other
Implements
IMessage<T>.MergeFrom(T)

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

Declaration
public void SetExtension<TValue>(Extension<MessageOptions, TValue> extension, TValue value)
Parameters
Type Name Description
Extension<MessageOptions, TValue> extension
TValue value
Type Parameters
Name Description
TValue
Implements
IExtendableMessage<T>.SetExtension<TValue>(Extension<T, TValue>, TValue)

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

WriteTo(CodedOutputStream)

Declaration
public void WriteTo(CodedOutputStream output)
Parameters
Type Name Description
CodedOutputStream output
Implements
IMessage.WriteTo(CodedOutputStream)

Explicit Interface Implementations

IMessage.Descriptor

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

Extension Methods

MessageExtensions.MergeFrom(IMessage, Byte[])
MessageExtensions.MergeFrom(IMessage, Byte[], Int32, Int32)
MessageExtensions.MergeFrom(IMessage, ByteString)
MessageExtensions.MergeFrom(IMessage, Stream)
MessageExtensions.MergeDelimitedFrom(IMessage, Stream)
MessageExtensions.ToByteArray(IMessage)
MessageExtensions.WriteTo(IMessage, Stream)
MessageExtensions.WriteDelimitedTo(IMessage, Stream)
MessageExtensions.ToByteString(IMessage)
MessageExtensions.IsInitialized(IMessage)
Back to top