Show / Hide Table of Contents

Class TypeRegistry

An immutable registry of types which can be looked up by their full name.

Inheritance
System.Object
TypeRegistry
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Google.Protobuf.Reflection
Assembly: Google.Protobuf.dll
Syntax
public sealed class TypeRegistry

Properties

Empty

An empty type registry, containing no types.

Declaration
public static TypeRegistry Empty { get; }
Property Value
Type Description
TypeRegistry

Methods

Find(String)

Attempts to find a message descriptor by its full name.

Declaration
public MessageDescriptor Find(string fullName)
Parameters
Type Name Description
System.String fullName

The full name of the message, which is the dot-separated combination of package, containing messages and message name

Returns
Type Description
MessageDescriptor

The message descriptor corresponding to fullName or null if there is no such message descriptor.

FromFiles(FileDescriptor[])

Creates a type registry from the specified set of file descriptors.

Declaration
public static TypeRegistry FromFiles(params FileDescriptor[] fileDescriptors)
Parameters
Type Name Description
FileDescriptor[] fileDescriptors

The set of files to include in the registry. Must not contain null values.

Returns
Type Description
TypeRegistry

A type registry for the given files.

Remarks

This is a convenience overload for FromFiles(IEnumerable<FileDescriptor>) to allow calls such as TypeRegistry.FromFiles(descriptor1, descriptor2).

FromFiles(IEnumerable<FileDescriptor>)

Creates a type registry from the specified set of file descriptors.

Declaration
public static TypeRegistry FromFiles(IEnumerable<FileDescriptor> fileDescriptors)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<FileDescriptor> fileDescriptors

The set of files to include in the registry. Must not contain null values.

Returns
Type Description
TypeRegistry

A type registry for the given files.

Remarks

All message types within all the specified files are added to the registry, and the dependencies of the specified files are also added, recursively.

FromMessages(MessageDescriptor[])

Creates a type registry from the file descriptor parents of the specified set of message descriptors.

Declaration
public static TypeRegistry FromMessages(params MessageDescriptor[] messageDescriptors)
Parameters
Type Name Description
MessageDescriptor[] messageDescriptors

The set of message descriptors to use to identify file descriptors to include in the registry. Must not contain null values.

Returns
Type Description
TypeRegistry

A type registry for the given files.

Remarks

This is a convenience overload for FromMessages(IEnumerable<MessageDescriptor>) to allow calls such as TypeRegistry.FromFiles(descriptor1, descriptor2).

FromMessages(IEnumerable<MessageDescriptor>)

Creates a type registry from the file descriptor parents of the specified set of message descriptors.

Declaration
public static TypeRegistry FromMessages(IEnumerable<MessageDescriptor> messageDescriptors)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<MessageDescriptor> messageDescriptors

The set of message descriptors to use to identify file descriptors to include in the registry. Must not contain null values.

Returns
Type Description
TypeRegistry

A type registry for the given files.

Remarks

The specified message descriptors are only used to identify their file descriptors; the returned registry contains all the types within the file descriptors which contain the specified message descriptors (and the dependencies of those files), not just the specified messages.

Back to top