Describes a .proto file, including everything defined within.
IDescriptor is implemented such that the File property returns this descriptor, and the FullName is the same as the Name.
Properties |
|
---|---|
Dependencies
|
IList< FileDescriptor >
Unmodifiable list of this file's dependencies (imports).
|
DescriptorPool
|
DescriptorPool
Pool containing symbol descriptors.
|
DescriptorProtoFileDescriptor
|
Returns the file descriptor for descriptor.proto.
|
EnumTypes
|
IList< EnumDescriptor >
Unmodifiable list of top-level enum types declared in this file.
|
MessageTypes
|
IList< MessageDescriptor >
Unmodifiable list of top-level message types declared in this file.
|
Proto
|
FileDescriptorProto
The descriptor in its protocol message representation.
|
PublicDependencies
|
IList< FileDescriptor >
Unmodifiable list of this file's public dependencies (public imports).
|
SerializedData
|
The original serialized binary form of this descriptor.
|
Services
|
IList< ServiceDescriptor >
Unmodifiable list of top-level services declared in this file.
|
Public attributes |
|
---|---|
Name => Proto.Name
|
string
The file name.
|
Package => Proto.Package
|
string
The package as declared in the .proto file.
|
Public functions |
|
---|---|
FindTypeByName< T >(String name)
|
T
Finds a type (message, enum, service or extension) in the file by name.
|
ToString()
|
override string
Returns a System.String that represents this instance.
|
Public static functions |
|
---|---|
FromGeneratedCode(byte[] descriptorData, FileDescriptor[] dependencies, GeneratedClrTypeInfo generatedCodeInfo)
|
Creates a descriptor for generated code.
|
IList< FileDescriptor > Dependencies
Unmodifiable list of this file's dependencies (imports).
DescriptorPool DescriptorPool
Pool containing symbol descriptors.
FileDescriptor DescriptorProtoFileDescriptor
Returns the file descriptor for descriptor.proto.
This is used for protos which take a direct dependency on descriptor.proto
, typically for annotations. While descriptor.proto
is a proto2 file, it is built into the Google.Protobuf runtime for reflection purposes. The messages are internal to the runtime as they would require proto2 semantics for full support, but the file descriptor is available via this property. The C# codegen in protoc automatically uses this property when it detects a dependency on descriptor.proto
.
The file descriptor for descriptor.proto
.
IList< EnumDescriptor > EnumTypes
Unmodifiable list of top-level enum types declared in this file.
IList< MessageDescriptor > MessageTypes
Unmodifiable list of top-level message types declared in this file.
FileDescriptorProto Proto
The descriptor in its protocol message representation.
IList< FileDescriptor > PublicDependencies
Unmodifiable list of this file's public dependencies (public imports).
IList< ServiceDescriptor > Services
Unmodifiable list of top-level services declared in this file.
string Name => Proto.Name
The file name.
string Package => Proto.Package
The package as declared in the .proto file.
This may or may not be equivalent to the .NET namespace of the generated classes.
T FindTypeByName< T >( String name )
Finds a type (message, enum, service or extension) in the file by name.
Does not find nested types.
Details | |||
---|---|---|---|
Parameters |
|
||
Template Parameters |
|
||
Returns |
The type's descriptor, or null if not found.
|
override string ToString()
Returns a System.String that represents this instance.
Details | |
---|---|
Returns |
A System.String that represents this instance.
|
FileDescriptor FromGeneratedCode( byte[] descriptorData, FileDescriptor[] dependencies, GeneratedClrTypeInfo generatedCodeInfo )
Creates a descriptor for generated code.
This method is only designed to be used by the results of generating code with protoc, which creates the appropriate dependencies etc. It has to be public because the generated code is "external", but should not be called directly by end users.