Class MessageDescriptor.FieldCollection (3.23.0)

public sealed class MessageDescriptor.FieldCollection

A collection to simplify retrieving the field accessor for a particular field.

Inheritance

object > MessageDescriptor.FieldCollection

Namespace

Google.Protobuf.Reflection

Assembly

Google.Protobuf.dll

Properties

this[int]

public FieldDescriptor this[int number] { get; }

Retrieves the descriptor for the field with the given number.

Parameter
NameDescription
numberint

Number of the field to retrieve the descriptor for

Property Value
TypeDescription
FieldDescriptor

The accessor for the given field

Exceptions
TypeDescription
KeyNotFoundException

The message descriptor does not contain a field with the given number

this[string]

public FieldDescriptor this[string name] { get; }

Retrieves the descriptor for the field with the given name.

Parameter
NameDescription
namestring

Name of the field to retrieve the descriptor for

Property Value
TypeDescription
FieldDescriptor

The descriptor for the given field

Exceptions
TypeDescription
KeyNotFoundException

The message descriptor does not contain a field with the given name

Methods

InDeclarationOrder()

public IList<FieldDescriptor> InDeclarationOrder()
Returns
TypeDescription
IListFieldDescriptor

Returns the fields in the message as an immutable list, in the order in which they are declared in the source .proto file.

InFieldNumberOrder()

public IList<FieldDescriptor> InFieldNumberOrder()
Returns
TypeDescription
IListFieldDescriptor

Returns the fields in the message as an immutable list, in ascending field number order. Field numbers need not be contiguous, so there is no direct mapping from the index in the list to the field number; to retrieve a field by field number, it is better to use the MessageDescriptor.FieldCollection indexer.