# CommentCollection.SyncRoot Property

> Gets an object that can be used to synchronize access to the collection.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 30.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Explicit:** implements `System.Collections.ICollection` explicitly; cast to the interface to use it
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > CommentCollection.SyncRoot Property
- **577 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/commentcollection/syncroot-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/commentcollection/syncroot-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/commentcollection/syncroot-property/llms-full.txt

---

### Description

Gets an object that can be used to synchronize access to the collection.

### Syntax

The type implements this member of System.Collections.ICollection explicitly: code reaches it by casting to the interface, as in ((ICollection)value).SyncRoot.

```csharp
object ICollection.SyncRoot { get; }
```

```vbnet
Private ReadOnly Property SyncRoot As Object Implements ICollection.SyncRoot
```

### Examples

The following example works with comments in the current document by using `CommentCollection.syncroot`.

```csharp
CommentCollection commentCollection = textControl.Comments;
textControl.Text = "Payment is due within 30 days.";
textControl.Select(0, textControl.Text.Length);
commentCollection.Add(new CommentedText("Verify the payment term."));

ICollection collection = commentCollection;
var value = collection.SyncRoot;
```

```vbnet
Dim commentCollection As CommentCollection = textControl.Comments
textControl.Text = "Payment is due within 30 days."
textControl.Select(0, textControl.Text.Length)
commentCollection.Add(New CommentedText("Verify the payment term."))

Dim collection As ICollection = commentCollection
Dim value = collection.SyncRoot
```

### Limitations

Read only.

---

## Nearby

- **Previous:** [CommentCollection.Remove Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/commentcollection/remove-method/llms-full.txt)
- **Next:** [CommentedText Class](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/commentedtext/llms-full.txt)
