Class OneofDescriptor
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.
Implements
Inherited Members
Namespace: Google.Protobuf.Reflection
Assembly: Google.Protobuf.dll
Syntax
public sealed class OneofDescriptor : DescriptorBase, IDescriptor
Properties
Accessor
Gets an accessor for reflective access to the values associated with the oneof in a particular message.
Declaration
public OneofAccessor Accessor { get; }
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
Gets the message type containing this oneof.
Declaration
public MessageDescriptor ContainingType { get; }
Property Value
Type | Description |
---|---|
MessageDescriptor | The message type containing this oneof. |
CustomOptions
The (possibly empty) set of custom options for this oneof.
Declaration
[Obsolete("CustomOptions are obsolete. Use GetOption")]
public CustomOptions CustomOptions { get; }
Property Value
Type | Description |
---|---|
CustomOptions |
Fields
Gets the fields within this oneof, in declaration order.
Declaration
public IList<FieldDescriptor> Fields { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<FieldDescriptor> | The fields within this oneof, in declaration order. |
Name
The brief name of the descriptor's target.
Declaration
public override string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
Methods
GetOption<T>(Extension<OneofOptions, T>)
Gets a single value oneof option for this descriptor
Declaration
public T GetOption<T>(Extension<OneofOptions, T> extension)
Parameters
Type | Name | Description |
---|---|---|
Extension<OneofOptions, T> | extension |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
GetOption<T>(RepeatedExtension<OneofOptions, T>)
Gets a repeated value oneof option for this descriptor
Declaration
public RepeatedField<T> GetOption<T>(RepeatedExtension<OneofOptions, T> extension)
Parameters
Type | Name | Description |
---|---|---|
RepeatedExtension<OneofOptions, T> | extension |
Returns
Type | Description |
---|---|
RepeatedField<T> |
Type Parameters
Name | Description |
---|---|
T |