Describes a message type.
Public attributes |
|
---|---|
Name => Proto.Name
|
override string
The brief name of the descriptor's target.
|
Properties |
|
---|---|
ClrType
|
Type
The CLR type used to represent message instances from this descriptor.
|
ContainingType
|
If this is a nested type, get the outer descriptor, otherwise null.
|
EnumTypes
|
IList< EnumDescriptor >
An unmodifiable list of this message type's enum types.
|
Fields
|
A collection of fields, which can be retrieved by name or field number.
|
NestedTypes
|
IList< MessageDescriptor >
An unmodifiable list of this message type's nested types.
|
Oneofs
|
IList< OneofDescriptor >
An unmodifiable list of the "oneof" field collections in this message type.
|
Parser
|
A parser for this message type.
|
Proto
|
DescriptorProto
|
Public functions |
|
---|---|
FindDescriptor< T >(string name)
|
T
Finds a nested descriptor by name.
|
FindFieldByName(String name)
|
Finds a field by field name.
|
FindFieldByNumber(int number)
|
Finds a field by field number.
|
Classes |
|
---|---|
Google. |
A collection to simplify retrieving the field accessor for a particular field. |
override string Name => Proto.Name
The brief name of the descriptor's target.
Type ClrType
The CLR type used to represent message instances from this descriptor.
The value returned by this property will be non-null for all regular fields. However, if a message containing a map field is introspected, the list of nested messages will include an auto-generated nested key/value pair message for the field. This is not represented in any generated type, so this property will return null in such cases.
For wrapper types (Google.Protobuf.WellKnownTypes.StringValue and the like), the type returned here will be the generated message type, not the native type used by reflection for fields of those types. Code using reflection should call IsWrapperType to determine whether a message descriptor represents a wrapper type, and handle the result appropriately.
MessageDescriptor ContainingType
If this is a nested type, get the outer descriptor, otherwise null.
FieldCollection Fields
A collection of fields, which can be retrieved by name or field number.
IList< MessageDescriptor > NestedTypes
An unmodifiable list of this message type's nested types.
IList< OneofDescriptor > Oneofs
An unmodifiable list of the "oneof" field collections in this message type.
MessageParser Parser
A parser for this message type.
As MessageDescriptor is not generic, this cannot be statically typed to the relevant type, but it should produce objects of a type compatible with ClrType.
The value returned by this property will be non-null for all regular fields. However, if a message containing a map field is introspected, the list of nested messages will include an auto-generated nested key/value pair message for the field. No message parser object is created for such messages, so this property will return null in such cases.
For wrapper types (Google.Protobuf.WellKnownTypes.StringValue and the like), the parser returned here will be the generated message type, not the native type used by reflection for fields of those types. Code using reflection should call IsWrapperType to determine whether a message descriptor represents a wrapper type, and handle the result appropriately.
DescriptorProto Proto
T FindDescriptor< T >( string name )
Finds a nested descriptor by name.
The is valid for fields, nested message types, oneofs and enums.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The descriptor, or null if not found.
|
FieldDescriptor FindFieldByName( String name )
Finds a field by field name.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The field's descriptor, or null if not found.
|
FieldDescriptor FindFieldByNumber( int number )
Finds a field by field number.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The field's descriptor, or null if not found.
|