Class OneofDescriptor

public sealed class OneofDescriptor : DescriptorBase, IDescriptor

Describes a "oneof" field collection in a message type: a set of fields of which at most one can be set in any particular message.

Inheritance

Object > DescriptorBase > OneofDescriptor

Implements

IDescriptor

Namespace

Google.Protobuf.Reflection

Assembly

Google.Protobuf.dll

Properties

Accessor

public OneofAccessor Accessor { get; }

Gets an accessor for reflective access to the values associated with the oneof in a particular message.

Property Value
TypeDescription
OneofAccessor

The accessor used for reflective access.

Remarks

In descriptors for generated code, the value returned by this property will always be non-null.

In dynamically loaded descriptors, the value returned by this property will current be null; if and when dynamic messages are supported, it will return a suitable accessor to work with them.

ContainingType

public MessageDescriptor ContainingType { get; }

Gets the message type containing this oneof.

Property Value
TypeDescription
MessageDescriptor

The message type containing this oneof.

CustomOptions

public CustomOptions CustomOptions { get; }

The (possibly empty) set of custom options for this oneof.

Property Value
TypeDescription
CustomOptions

Fields

public IList<FieldDescriptor> Fields { get; }

Gets the fields within this oneof, in declaration order.

Property Value
TypeDescription
IList<FieldDescriptor>

The fields within this oneof, in declaration order.

IsSynthetic

public bool IsSynthetic { get; }

Returns true if this oneof is a synthetic oneof containing a proto3 optional field; false otherwise.

Property Value
TypeDescription
Boolean

Name

public override string Name { get; }

The brief name of the descriptor's target.

Property Value
TypeDescription
String
Overrides

Methods

GetOption<T>(Extension<OneofOptions, T>)

public T GetOption<T>(Extension<OneofOptions, T> extension)

Gets a single value oneof option for this descriptor

Parameter
TypeNameDescription
Extension<OneofOptions, T>extension
Returns
TypeDescription
T
Type Parameter
NameDescription
T

GetOption<T>(RepeatedExtension<OneofOptions, T>)

public RepeatedField<T> GetOption<T>(RepeatedExtension<OneofOptions, T> extension)

Gets a repeated value oneof option for this descriptor

Parameter
TypeNameDescription
RepeatedExtension<OneofOptions, T>extension
Returns
TypeDescription
RepeatedField<T>
Type Parameter
NameDescription
T

GetOptions()

public OneofOptions GetOptions()

The OneofOptions, defined in descriptor.proto. If the options message is not present (i.e. there are no options), null is returned. Custom options can be retrieved as extensions of the returned message. NOTE: A defensive copy is created each time this property is retrieved.

Returns
TypeDescription
OneofOptions

Implements