Class EnumDescriptor
Descriptor for an enum type in a .proto file.
Implements
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Google.Protobuf.Reflection
Assembly: Google.Protobuf.dll
Syntax
public sealed class EnumDescriptor : DescriptorBase, IDescriptor
Properties
ClrType
The CLR type for this enum. For generated code, this will be a CLR enum type.
Declaration
public Type ClrType { get; }
Property Value
Type | Description |
---|---|
System.Type |
ContainingType
Declaration
public MessageDescriptor ContainingType { get; }
Property Value
Type | Description |
---|---|
MessageDescriptor | If this is a nested type, get the outer descriptor, otherwise null. |
CustomOptions
The (possibly empty) set of custom options for this enum.
Declaration
public CustomOptions CustomOptions { get; }
Property Value
Type | Description |
---|---|
CustomOptions |
Name
The brief name of the descriptor's target.
Declaration
public override string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
Values
Declaration
public IList<EnumValueDescriptor> Values { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<EnumValueDescriptor> | An unmodifiable list of defined value descriptors for this enum. |
Methods
FindValueByName(String)
Finds an enum value by name.
Declaration
public EnumValueDescriptor FindValueByName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The unqualified name of the value (e.g. "FOO"). |
Returns
Type | Description |
---|---|
EnumValueDescriptor | The value's descriptor, or null if not found. |
FindValueByNumber(Int32)
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
.
Declaration
public EnumValueDescriptor FindValueByNumber(int number)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | number |
Returns
Type | Description |
---|---|
EnumValueDescriptor |