Send feedback
Class EnumDescriptor (3.15.8)
Stay organized with collections
Save and categorize content based on your preferences.
Version 3.15.8 keyboard_arrow_down
public sealed class EnumDescriptor : DescriptorBase, IDescriptor
Descriptor for an enum type in a .proto file.
Namespace
Google.Protobuf.Reflection
Assembly
Google.Protobuf.dll
Properties
ClrType
public Type ClrType { get; }
The CLR type for this enum. For generated code, this will be a CLR enum type.
Property Value Type Description Type
ContainingType
public MessageDescriptor ContainingType { get; }
Property Value Type Description MessageDescriptor
If this is a nested type, get the outer descriptor, otherwise null.
CustomOptions
public CustomOptions CustomOptions { get; }
The (possibly empty) set of custom options for this enum.
Name
public override string Name { get; }
The brief name of the descriptor's target.
Property Value Type Description String
Overrides
Values
public IList<EnumValueDescriptor> Values { get; }
Property Value Type Description IList <EnumValueDescriptor >
An unmodifiable list of defined value descriptors for this enum.
Methods
FindValueByName(String)
public EnumValueDescriptor FindValueByName(string name)
Finds an enum value by name.
Parameter Name Description name
String
The unqualified name of the value (e.g. "FOO").
FindValueByNumber(Int32)
public EnumValueDescriptor FindValueByNumber(int number)
Finds an enum value by number. If multiple enum values have the
same number, this returns the first defined value with that number.
If there is no value for the given number, this returns null
.
Parameter Name Description number
Int32
GetOption<T>(Extension<EnumOptions, T>)
public T GetOption<T>(Extension<EnumOptions, T> extension)
Gets a single value enum option for this descriptor
Type Parameter Name Description T
GetOption<T>(RepeatedExtension<EnumOptions, T>)
public RepeatedField<T> GetOption<T>(RepeatedExtension<EnumOptions, T> extension)
Gets a repeated value enum option for this descriptor
Type Parameter Name Description T
GetOptions()
public EnumOptions GetOptions()
The EnumOptions
, 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.
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-16 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?