Google.Protobuf.Reflection.EnumDescriptor

Descriptor for an enum type in a .proto file.

Summary

Inheritance

Inherits from: Google.Protobuf.Reflection.DescriptorBase

Properties

ClrType
Type
The CLR type for this enum.
ContainingType
If this is a nested type, get the outer descriptor, otherwise null.
Name
override string
The brief name of the descriptor's target.
Proto
EnumDescriptorProto
Values
An unmodifiable list of defined value descriptors for this enum.

Public functions

FindValueByName(string name)
Finds an enum value by name.
FindValueByNumber(int number)
Finds an enum value by number.

Properties

ClrType

Type ClrType

The CLR type for this enum.

For generated code, this will be a CLR enum type.

ContainingType

MessageDescriptor ContainingType

If this is a nested type, get the outer descriptor, otherwise null.

Name

override string Name

The brief name of the descriptor's target.

Proto

EnumDescriptorProto Proto

Values

IList< EnumValueDescriptor > Values

An unmodifiable list of defined value descriptors for this enum.

Public functions

FindValueByName

EnumValueDescriptor FindValueByName(
  string name
)

Finds an enum value by name.

Details
Parameters
name
The unqualified name of the value (e.g. "FOO").
Returns
The value's descriptor, or null if not found.

FindValueByNumber

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.