# ConditionalInstructionCollection Class

> An instance of the ConditionalInstructionCollection class contains all conditional instructions in a Text Control document or part of the document represented through objects of type ConditionalInstruction. An instance of this class can be obtained with the FormFieldCollection.ConditionalInstructions property. The ConditionalInstructionCollection class implements the IEnumerable and the ICollection interfaces.

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

---

### Description

An instance of the ConditionalInstructionCollection class contains all conditional instructions in a Text Control document or part of the document represented through objects of type [ConditionalInstruction](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/conditionalinstruction/llms-full.txt). An instance of this class can be obtained with the [FormFieldCollection.ConditionalInstructions](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/formfieldcollection/conditionalinstructions-property/llms-full.txt) property. The ConditionalInstructionCollection class implements the `IEnumerable` and the `ICollection` interfaces.

### Syntax

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

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

### Examples

The following example includes the conditional instruction names value from a Conditional Instruction Collection object in application diagnostics. The created object is then available to the surrounding document workflow.

```csharp
Console.WriteLine($"Conditional Instruction Names: {conditionalInstructionCollection.ConditionalInstructionNames}");
Console.WriteLine("Conditional Instruction Collection is ready for use.");
```

```vbnet
Console.WriteLine($"Conditional Instruction Names: {conditionalInstructionCollection.ConditionalInstructionNames}")
Console.WriteLine("Conditional Instruction Collection is ready for use.")
```

---

## In This Section

- [ConditionalInstructionCollection.Add Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/conditionalinstructioncollection/add-method/llms-full.txt): Inserts an instance of the class ConditionalInstruction to the collection and the document.
- [ConditionalInstructionCollection.Clear Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/conditionalinstructioncollection/clear-method/llms-full.txt): Removes all conditional instructions from the collection and the document.
- [ConditionalInstructionCollection.ConditionalInstructionNames Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/conditionalinstructioncollection/conditionalinstructionnames-property/llms-full.txt): Gets the names of all ConditionalInstruction elements that are listed inside the collection.
- [ConditionalInstructionCollection.CopyTo Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/conditionalinstructioncollection/copyto-method/llms-full.txt): Copies the elements of the collection to an array, starting at a particular index.
- [ConditionalInstructionCollection.Count Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/conditionalinstructioncollection/count-property/llms-full.txt): Gets the number of elements contained in the collection.
- [ConditionalInstructionCollection.GetEnumerator Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/conditionalinstructioncollection/getenumerator-method/llms-full.txt): Returns an enumerator that can be used to iterate through the collection.
- [ConditionalInstructionCollection.GetItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/conditionalinstructioncollection/getitem-method/llms-full.txt): Gets that ConditionalInstruction element from the collection, where the Name property value equals the specified name.
- [ConditionalInstructionCollection.GetItems Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/conditionalinstructioncollection/getitems-method/llms-full.txt): Gets those ConditionalInstruction elements from the collection, where at least one Condition or Instruction element references the specified FormField.
- [ConditionalInstructionCollection.IsValueValid Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/conditionalinstructioncollection/isvaluevalid-method/llms-full.txt): Returns a value indicating whether the value of a specific form field is marked as valid. The corresponding validation is executed by the conditions of a conditional instruction and applied by an Instruction object, that marks the related form field as valid or invalid.
- [ConditionalInstructionCollection.Remove Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/conditionalinstructioncollection/remove-method/llms-full.txt): Removes that ConditionalInstruction element from the collection and the document, where the Name property value equals the specified name.

---

## Nearby

- **Previous:** [ConditionalInstruction.Name Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/conditionalinstruction/name-property/llms-full.txt)
- **Next:** [ConditionalInstructionCollection.Add Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/conditionalinstructioncollection/add-method/llms-full.txt)
