# TextCharCollection Class

> An instance of the TextCharCollection class contains all characters in a Text Control document or part of the document represented through objects of the type TextChar. An instance of this class can be obtained with the TextControl.TextChars, HeaderFooter.TextChars or TextFrame.TextChars property. The TextCharCollection class implements the IEnumerable and the ICollection interfaces.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Class
- **Introduced:** 10.1
- **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
- **Implements:** `System.Collections.ICollection`, `System.Collections.IEnumerable`
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > TextCharCollection Class
- **837 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textcharcollection/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textcharcollection/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textcharcollection/llms-full.txt

---

### Description

An instance of the TextCharCollection class contains all characters in a Text Control document or part of the document represented through objects of the type [TextChar](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textchar/llms-full.txt). An instance of this class can be obtained with the [TextControl.TextChars](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/textchars-property/llms-full.txt), [HeaderFooter.TextChars](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfooter/textchars-property/llms-full.txt) or [TextFrame.TextChars](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textframe/textchars-property/llms-full.txt) property. The TextCharCollection class implements the IEnumerable and the ICollection interfaces.

### Syntax

```csharp
public class TextCharCollection : ICollection, IEnumerable
```

```vbnet
Public Class TextCharCollection
    Implements ICollection, IEnumerable
```

### Examples

The following example works with text chars in the current document.

```csharp
TextCharCollection textCharCollection = textControl.TextChars;
textControl.Text = "Quarterly results\nRevenue increased by 12%.";
```

```vbnet
Dim textCharCollection As TextCharCollection = textControl.TextChars
textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."
```

---

## In This Section

- [TextCharCollection.Add Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textcharcollection/add-method/llms-full.txt): Adds a character to the document.
- [TextCharCollection.CopyTo Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textcharcollection/copyto-method/llms-full.txt): Copies the elements of the collection to an array, starting at a particular index.
- [TextCharCollection.Count Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textcharcollection/count-property/llms-full.txt): Gets the number of elements contained in the collection.
- [TextCharCollection.GetEnumerator Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textcharcollection/getenumerator-method/llms-full.txt): Returns an enumerator that can be used to iterate through the collection.
- [TextCharCollection.GetItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textcharcollection/getitem-method/llms-full.txt): Gets a particular character from the collection specified through a certain geometrical position.
- [TextCharCollection.Item Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textcharcollection/item-property/llms-full.txt): Gets the character from the collection. In C# this property is the indexer for the TextCharCollection class.
- [TextCharCollection.Remove Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textcharcollection/remove-method/llms-full.txt): Removes a character from a Text Control document. The method can also be used to remove control characters. Single control characters which are important for other formatting attributes, i.e. a table cell end character, cannot be removed through this method.

---

## Nearby

- **Previous:** [TextChar.Number Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textchar/number-property/llms-full.txt)
- **Next:** [TextCharCollection.Add Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/textcharcollection/add-method/llms-full.txt)
