Google.Protobuf by Google Inc.

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

 FileDescriptor

public sealed class FileDescriptor : IDescriptor
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.

Returns the file descriptor for descriptor.proto.

public CustomOptions CustomOptions { get; }

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

public IList<EnumDescriptor> EnumTypes { get; }

Unmodifiable list of top-level extensions declared in this file. Note that some extensions may be incomplete (FieldDescriptor.Extension may be null) if this descriptor was generated using a version of protoc that did not fully support extensions in C#.

public string Name { get; }

public string Package { get; }

The package as declared in the .proto file. This may or may not be equivalent to the .NET namespace of the generated classes.

public ByteString SerializedData { get; }

public IList<ServiceDescriptor> Services { get; }

public Syntax Syntax { get; }

The syntax of the file

Converts the given descriptor binary data into FileDescriptor objects. Note: reflection using the returned FileDescriptors is not currently supported.

Converts the given descriptor binary data into FileDescriptor objects. Note: reflection using the returned FileDescriptors is not currently supported.

public static void ForceReflectionInitialization<T>()

Performs initialization for the given generic type argument.

public static FileDescriptor FromGeneratedCode(byte[] descriptorData, FileDescriptor[] dependencies, GeneratedClrTypeInfo generatedCodeInfo)

Creates a descriptor for generated code.

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

Finds a type (message, enum, service or extension) in the file by name. Does not find nested types.

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

Gets a single value file option for this descriptor

Gets a repeated value file option for this descriptor

The FileOptions, 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 FileDescriptorProto describing this file. 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.