Class EnumValueDescriptor (3.23.0)

public sealed class EnumValueDescriptor : DescriptorBase, IDescriptor

Descriptor for a single enum value within an enum in a .proto file.

Inheritance

object > DescriptorBase > EnumValueDescriptor

Implements

IDescriptor

Namespace

Google.Protobuf.Reflection

Assembly

Google.Protobuf.dll

Properties

CustomOptions

[Obsolete("CustomOptions are obsolete. Use the GetOptions() method.")]
public CustomOptions CustomOptions { get; }

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

Property Value
Type Description
CustomOptions

EnumDescriptor

public EnumDescriptor EnumDescriptor { get; }

Returns the enum descriptor that this value is part of.

Property Value
Type Description
EnumDescriptor

Name

public override string Name { get; }

Returns the name of the enum value described by this object.

Property Value
Type Description
string
Overrides

Number

public int Number { get; }

Returns the number associated with this enum value.

Property Value
Type Description
int

Methods

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

[Obsolete("GetOption is obsolete. Use the GetOptions() method.")]
public T GetOption<T>(Extension<EnumValueOptions, T> extension)

Gets a single value enum value option for this descriptor

Parameter
Name Description
extension ExtensionEnumValueOptions
Returns
Type Description
T
Type Parameter
Name Description
T

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

[Obsolete("GetOption is obsolete. Use the GetOptions() method.")]
public RepeatedField<T> GetOption<T>(RepeatedExtension<EnumValueOptions, T> extension)

Gets a repeated value enum value option for this descriptor

Parameter
Name Description
extension RepeatedExtensionEnumValueOptions
Returns
Type Description
RepeatedField
Type Parameter
Name Description
T

GetOptions()

public EnumValueOptions GetOptions()

The EnumValueOptions, 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
EnumValueOptions

ToProto()

public EnumValueDescriptorProto ToProto()

Returns a clone of the underlying EnumValueDescriptorProto describing this enum value. 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.

Returns
Type Description
EnumValueDescriptorProto

A protobuf representation of this enum value descriptor.