CopyTo Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. Core. SDK TXTextControl.from the private NuGet feed or Text Control Offline PackagesCore. dll
- Also in
TXTextControl.asTextControl. ASP. SDK TXTextControl.dll
Description
Copies the elements of the collection to an array, starting at a particular index.
Syntax
public override void CopyTo(Array array, int index);Public Overrides Sub CopyTo(array As Array, index As Integer)Parameters
| Parameter | Description |
|---|---|
| array | Specifies the array to copy to. |
| index | Specifies the index of the destination array at which to begin copying. |
Examples
The following example copies application fields to a stable array before updating their visible merge results.
textControl.Text = "Dear ,";
textControl.InputPosition = new InputPosition(5);
ApplicationFieldCollection fields = textControl.ApplicationFields;
ApplicationField customerField = new(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", new[] { "CustomerName" }) { ID = 100 };
fields.Add(customerField);
ApplicationField[] snapshot = new ApplicationField[fields.Count];
fields.CopyTo(snapshot, 0);
foreach (ApplicationField field in snapshot)
{
field.Text = "Pending merge";
}textControl.Text = "Dear ,"
textControl.InputPosition = New InputPosition(5)
Dim fields As ApplicationFieldCollection = textControl.ApplicationFields
Dim customerField As New ApplicationField(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", New String() { "CustomerName" }) With { .ID = 100 }
fields.Add(customerField)
Dim snapshot(fields.Count - 1) As ApplicationField
fields.CopyTo(snapshot, 0)
For Each field As ApplicationField In snapshot
field.Text = "Pending merge"
Next