# Class TypeRegistry (3.27.1)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [3.27.1 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.TypeRegistry)
- [3.23.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/3.23.0/Google.Protobuf.Reflection.TypeRegistry)
- [3.15.8](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/3.15.8/Google.Protobuf.Reflection.TypeRegistry)

    public sealed class TypeRegistry

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

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> TypeRegistry

## Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Protobuf.Reflection](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection)

## Assembly

Google.Protobuf.dll

## Properties

### Empty

    public static TypeRegistry Empty { get; }

An empty type registry, containing no types.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.TypeRegistry` |   |

## Methods

### Find(string)

    public MessageDescriptor Find(string fullName)

Attempts to find a message descriptor by its full name.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `fullName` | `https://learn.microsoft.com/dotnet/api/system.string` The full name of the message, which is the dot-separated combination of package, containing messages and message name |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.MessageDescriptor` | The message descriptor corresponding to `fullName` or null if there is no such message descriptor. |

### FromFiles(params FileDescriptor\[\])

    public static TypeRegistry FromFiles(params FileDescriptor[] fileDescriptors)

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `fileDescriptors` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.FileDescriptor` The set of files to include in the registry. Must not contain null values. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.TypeRegistry` | A type registry for the given files. |

**Remarks** This is a convenience overload for [FromFiles(IEnumerable\<FileDescriptor\>)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.TypeRegistry#Google_Protobuf_Reflection_TypeRegistry_FromFiles_System_Collections_Generic_IEnumerable_Google_Protobuf_Reflection_FileDescriptor__)
to allow calls such as `TypeRegistry.FromFiles(descriptor1, descriptor2)`.

### FromFiles(IEnumerable\<FileDescriptor\>)

    public static TypeRegistry FromFiles(IEnumerable<FileDescriptor> fileDescriptors)

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `fileDescriptors` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.FileDescriptor` The set of files to include in the registry. Must not contain null values. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.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(params MessageDescriptor\[\])

    public static TypeRegistry FromMessages(params MessageDescriptor[] messageDescriptors)

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `messageDescriptors` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.MessageDescriptor` The set of message descriptors to use to identify file descriptors to include in the registry. Must not contain null values. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.TypeRegistry` | A type registry for the given files. |

**Remarks** This is a convenience overload for [FromMessages(IEnumerable\<MessageDescriptor\>)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.TypeRegistry#Google_Protobuf_Reflection_TypeRegistry_FromMessages_System_Collections_Generic_IEnumerable_Google_Protobuf_Reflection_MessageDescriptor__)
to allow calls such as `TypeRegistry.FromFiles(descriptor1, descriptor2)`.

### FromMessages(IEnumerable\<MessageDescriptor\>)

    public static TypeRegistry FromMessages(IEnumerable<MessageDescriptor> messageDescriptors)

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `messageDescriptors` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.MessageDescriptor` The set of message descriptors to use to identify file descriptors to include in the registry. Must not contain null values. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.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.