# TableOfContentsCollection.Count Property

> Gets the number of elements contained in the collection.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 29.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
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > TableOfContentsCollection.Count Property
- **599 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontentscollection/count-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontentscollection/count-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontentscollection/count-property/llms-full.txt

---

### Description

Gets the number of elements contained in the collection.

### Syntax

```csharp
public int Count { get; }
```

```vbnet
Public ReadOnly Property Count As Integer
```

### Examples

The following example works with tables of contents in the current document by using `TableOfContentsCollection.Count`.

```csharp
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
TableOfContentsCollection tableOfContentsCollection = textControl.TablesOfContents;
tableOfContentsCollection.Add(new TableOfContents(1, 3) { Name = "Contents", ID = 100 });

Console.WriteLine($"Count: {tableOfContentsCollection.Count}");
Console.WriteLine("Table Of Contents Collection is ready for use.");
```

```vbnet
textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim tableOfContentsCollection As TableOfContentsCollection = textControl.TablesOfContents
tableOfContentsCollection.Add(New TableOfContents(1, 3) With { .Name = "Contents", .ID = 100 })

Console.WriteLine($"Count: {tableOfContentsCollection.Count}")
Console.WriteLine("Table Of Contents Collection is ready for use.")
```

### Limitations

Read only.

---

## Nearby

- **Previous:** [TableOfContentsCollection.CopyTo Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontentscollection/copyto-method/llms-full.txt)
- **Next:** [TableOfContentsCollection.GetEnumerator Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/tableofcontentscollection/getenumerator-method/llms-full.txt)
