# UserDefinedPropertyDictionary Class

> An instance of the UserDefinedPropertyDictionary class contains all user-defined document properties contained in a loaded document or which will be saved in a document. The UserDefinedPropertyDictionary class is used with the LoadSettings.UserDefinedDocumentProperties and SaveSettings.UserDefinedDocumentProperties properties. Each entry in the dictionary is a key/value pair, where the key is the name of the document property and the value is the document property's value. The foreach statement of the C# language (for each in Visual Basic) returns an object of the type of the elements in the collection. Since each element is a key/value pair, the element type is System.Collections.DictionaryEntry. The name must be of the type System.String and is limited to 255 characters. The value can be of the type System.String, System.Boolean, System.Int32 or System.Double.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Class
- **Introduced:** 24.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Inherits:** `System.Collections.DictionaryBase`
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl > UserDefinedPropertyDictionary Class
- **1020 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/userdefinedpropertydictionary/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/userdefinedpropertydictionary/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/userdefinedpropertydictionary/llms-full.txt

---

### Description

An instance of the UserDefinedPropertyDictionary class contains all user-defined document properties contained in a loaded document or which will be saved in a document. The UserDefinedPropertyDictionary class is used with the [LoadSettings.UserDefinedDocumentProperties](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/loadsettings/userdefineddocumentproperties-property/llms-full.txt) and [SaveSettings.UserDefinedDocumentProperties](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/savesettings/userdefineddocumentproperties-property/llms-full.txt) properties. Each entry in the dictionary is a key/value pair, where the key is the name of the document property and the value is the document property's value. The foreach statement of the C# language (for each in Visual Basic) returns an object of the type of the elements in the collection. Since each element is a key/value pair, the element type is System.Collections.DictionaryEntry. The name must be of the type System.String and is limited to 255 characters. The value can be of the type `System.String`, `System.Boolean`, `System.Int32` or `System.Double`.

### Syntax

```csharp
public class UserDefinedPropertyDictionary : DictionaryBase
```

```vbnet
Public Class UserDefinedPropertyDictionary
    Inherits DictionaryBase
```

### Examples

The following example creates a property dictionary and assigns it to the document settings.

```csharp
UserDefinedPropertyDictionary properties = new();
properties.Add("ReviewStatus", "Approved");
properties.Add("Department", "Finance");
textControl.DocumentSettings.UserDefinedDocumentProperties = properties;
```

```vbnet
Dim properties As New UserDefinedPropertyDictionary()
properties.Add("ReviewStatus", "Approved")
properties.Add("Department", "Finance")
textControl.DocumentSettings.UserDefinedDocumentProperties = properties
```

---

## In This Section

- [UserDefinedPropertyDictionary.Add Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/userdefinedpropertydictionary/add-method/llms-full.txt): Adds a new property to the dictionary.
- [UserDefinedPropertyDictionary Constructor](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/userdefinedpropertydictionary/constructor/llms-full.txt): Initializes a new instance of the UserDefinedPropertyDictionary class.
- [UserDefinedPropertyDictionary.Contains Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/userdefinedpropertydictionary/contains-method/llms-full.txt): Determines whether the dictionary contains a property with the specified name.
- [UserDefinedPropertyDictionary.Item Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/userdefinedpropertydictionary/item-property/llms-full.txt): Gets a document property from the dictionary. In C# this property is the indexer for the UserDefinedPropertyDictionary class. The property returns an object of the type System.String, System.Boolean, System.Int32 or System.Double which is the value associated with the specified name.
- [UserDefinedPropertyDictionary.Names Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/userdefinedpropertydictionary/names-property/llms-full.txt): Gets a collection of all property names the dictionary contains.
- [UserDefinedPropertyDictionary.Remove Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/userdefinedpropertydictionary/remove-method/llms-full.txt): Removes a document property from the dictionary.
- [UserDefinedPropertyDictionary.Values Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/userdefinedpropertydictionary/values-property/llms-full.txt): Gets a collection of all property values the dictionary contains.

---

## Nearby

- **Previous:** [TrackedChangesDialog.FindItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/trackedchangesdialog/finditem-method/llms-full.txt)
- **Next:** [UserDefinedPropertyDictionary.Add Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/userdefinedpropertydictionary/add-method/llms-full.txt)
