<PackageReference Include="Google.Protobuf" Version="3.34.0" />

Google.Protobuf.Reflection.OneofDescriptor

public sealed class OneofDescriptor : DescriptorBase
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.
public OneofAccessor Accessor { get; }

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

Gets the message type containing this oneof.

public CustomOptions CustomOptions { get; }

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

public IList<FieldDescriptor> Fields { get; }

Gets the fields within this oneof, in declaration order.

public bool IsSynthetic { get; }

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

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

Gets a single value oneof option for this descriptor

Gets a repeated value oneof option for this descriptor

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 a clone of the underlying OneofDescriptorProto describing this oneof. Note that a copy is taken every time this method is called, so clients using it frequently (and not modifying it) may want to cache the returned value.