<PackageReference Include="Google.Protobuf" Version="3.34.2" />

Google.Protobuf.Reflection.MessageDescriptor

public sealed class MessageDescriptor : DescriptorBase
Describes a message type.
public sealed class FieldCollection

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

public Type ClrType { get; }

The CLR type used to represent message instances from this descriptor.

public CustomOptions CustomOptions { get; }

The (possibly empty) set of custom options for this message.

public IList<EnumDescriptor> EnumTypes { get; }

An unmodifiable list of extensions defined in this message's scope. Note that some extensions may be incomplete (FieldDescriptor.Extension may be null) if they are declared in a file generated using a version of protoc that did not fully support extensions in C#.

public FieldCollection Fields { get; }

public bool IsMapEntry { get; }

Returns whether this message was synthetically-created to store key/value pairs in a map field.

public IList<OneofDescriptor> Oneofs { get; }

public MessageParser Parser { get; }

A parser for this message type.

public int RealOneofCount { get; }

The number of real "oneof" descriptors in this message type. Every element in Oneofs with an index less than this will have a IsSynthetic property value of false; every element with an index greater than or equal to this will have a IsSynthetic property value of true.

public T FindDescriptor<T>(string name) where T : IDescriptor

Finds a nested descriptor by name. The is valid for fields, nested message types, oneofs and enums.

public FieldDescriptor FindFieldByName(string name)

Finds a field by field name.

Finds a field by field number.

public T GetOption<T>(Extension<MessageOptions, T> extension)

Gets a single value message option for this descriptor

Gets a repeated value message option for this descriptor

The MessageOptions, defined in descriptor.proto. If the options message is not present (i.e. there are no options), null is returned. Custom options can be retrieved as extensions of the returned message. NOTE: A defensive copy is created each time this property is retrieved.

Returns a clone of the underlying DescriptorProto describing this message. Note that a copy is taken every time this method is called, so clients using it frequently (and not modifying it) may want to cache the returned value.