|
| 1 | +--- |
| 2 | +layout: "page" |
| 3 | +title: "FormatRegistry Class" |
| 4 | +bookmark: "FormatRegistry" |
| 5 | +permalink: "/api/JsonSchema.Net/:title/" |
| 6 | +order: "10.01.049" |
| 7 | +--- |
| 8 | +**Namespace:** Json.Schema |
| 9 | + |
| 10 | +**Inheritance:** |
| 11 | +`FormatRegistry` |
| 12 | + 🡒 |
| 13 | +`object` |
| 14 | + |
| 15 | +Represents a thread-safe registry for managing and retrieving format definitions within the application. |
| 16 | + |
| 17 | +## Remarks |
| 18 | + |
| 19 | +Use the FormatRegistry to register, unregister, and look up format definitions by key. The static |
| 20 | + Global property provides access to a shared, application-wide registry pre-populated with common formats. This class |
| 21 | + is designed for scenarios where centralized management of formats is required, and is safe for use across multiple |
| 22 | + |
| 23 | +## Properties |
| 24 | + |
| 25 | +| Name | Type | Summary | |
| 26 | +|---|---|---| |
| 27 | +| **Global** | FormatRegistry | Gets the global registry of formats available throughout the application. | |
| 28 | + |
| 29 | +## Methods |
| 30 | + |
| 31 | +### Get(string key) |
| 32 | + |
| 33 | +Retrieves the format associated with the specified key, searching local and global collections. |
| 34 | + |
| 35 | +#### Declaration |
| 36 | + |
| 37 | +```c# |
| 38 | +public Format Get(string key) |
| 39 | +``` |
| 40 | + |
| 41 | +| Parameter | Type | Description | |
| 42 | +|---|---|---| |
| 43 | +| key | string | The key that identifies the format to retrieve. Cannot be null. | |
| 44 | + |
| 45 | + |
| 46 | +#### Returns |
| 47 | + |
| 48 | +The format associated with the specified key if found; otherwise, a format representing an unknown key. |
| 49 | + |
| 50 | +#### Remarks |
| 51 | + |
| 52 | +If the format is not found in the local collection, the method searches the global collection |
| 53 | + |
| 54 | +### Register(Format format) |
| 55 | + |
| 56 | +Registers the specified format for later retrieval by its key. |
| 57 | + |
| 58 | +#### Declaration |
| 59 | + |
| 60 | +```c# |
| 61 | +public void Register(Format format) |
| 62 | +``` |
| 63 | + |
| 64 | +| Parameter | Type | Description | |
| 65 | +|---|---|---| |
| 66 | +| format | Format | The format to register. The format's key must be unique within the collection. | |
| 67 | + |
| 68 | + |
| 69 | +### Unregister(string name) |
| 70 | + |
| 71 | +Unregisters the format associated with the specified name, removing it from the collection if it exists. |
| 72 | + |
| 73 | +#### Declaration |
| 74 | + |
| 75 | +```c# |
| 76 | +public void Unregister(string name) |
| 77 | +``` |
| 78 | + |
| 79 | +| Parameter | Type | Description | |
| 80 | +|---|---|---| |
| 81 | +| name | string | The name of the format to unregister. Cannot be null. | |
| 82 | + |
| 83 | + |
| 84 | +#### Remarks |
| 85 | + |
| 86 | +If no format is registered with the specified name, this method has no effect. This method is |
| 87 | + |
0 commit comments