Class EnumDescriptor
Descriptor for an enum type in a .proto file.
Inheritance
System.Object
EnumDescriptor
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()
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
[Obsolete("CustomOptions are obsolete. Use GetOption")]
public CustomOptions CustomOptions { get; }
Property Value
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
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
GetOption<T>(Extension<EnumOptions, T>)
Gets a single value enum option for this descriptor
Declaration
public T GetOption<T>(Extension<EnumOptions, T> extension)
Parameters
Returns
Type Parameters
GetOption<T>(RepeatedExtension<EnumOptions, T>)
Gets a repeated value enum option for this descriptor
Declaration
public RepeatedField<T> GetOption<T>(RepeatedExtension<EnumOptions, T> extension)
Parameters
Returns
Type Parameters