Class OneofDescriptor (3.15.8)

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
Type Description
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
Type Description
MessageDescriptor

The message type containing this oneof.

CustomOptions

public CustomOptions CustomOptions { get; }

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

Property Value
Type Description
CustomOptions

Fields

public IList<FieldDescriptor> Fields { get; }

Gets the fields within this oneof, in declaration order.

Property Value
Type Description
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
Type Description
Boolean

Name

public override string Name { get; }

The brief name of the descriptor's target.

Property Value
Type Description
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
Name Description
extension Extension<OneofOptions, T>
Returns
Type Description
T
Type Parameter
Name Description
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
Name Description
extension RepeatedExtension<OneofOptions, T>
Returns
Type Description
RepeatedField<T>
Type Parameter
Name Description
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
Type Description
OneofOptions