Class MessageDescriptor.FieldCollection
A collection to simplify retrieving the field accessor for a particular field.
Inheritance
Inherited Members
Namespace: Google.Protobuf.Reflection
Assembly: Google.Protobuf.dll
Syntax
public sealed class FieldCollection
Properties
Item[Int32]
Retrieves the descriptor for the field with the given number.
Declaration
public FieldDescriptor this[int number] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | number | Number of the field to retrieve the descriptor for |
Property Value
| Type | Description |
|---|---|
| FieldDescriptor | The accessor for the given field |
Exceptions
| Type | Condition |
|---|---|
| System.Collections.Generic.KeyNotFoundException | The message descriptor does not contain a field with the given number |
Item[String]
Retrieves the descriptor for the field with the given name.
Declaration
public FieldDescriptor this[string name] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Name of the field to retrieve the descriptor for |
Property Value
| Type | Description |
|---|---|
| FieldDescriptor | The descriptor for the given field |
Exceptions
| Type | Condition |
|---|---|
| System.Collections.Generic.KeyNotFoundException | The message descriptor does not contain a field with the given name |
Methods
InDeclarationOrder()
Declaration
public IList<FieldDescriptor> InDeclarationOrder()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IList<FieldDescriptor> | Returns the fields in the message as an immutable list, in the order in which they are declared in the source .proto file. |
InFieldNumberOrder()
Declaration
public IList<FieldDescriptor> InFieldNumberOrder()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IList<FieldDescriptor> | 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. |