CopyTo Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WPF. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
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 page-number fields to an array before applying a consistent number format.
textControl.HeadersAndFooters.Add(HeaderFooterType.Footer);
HeaderFooter footer = textControl.HeadersAndFooters.GetItem(HeaderFooterType.Footer);
PageNumberFieldCollection fields = footer.PageNumberFields;
fields.Add(new PageNumberField());
PageNumberField[] snapshot = new PageNumberField[fields.Count];
fields.CopyTo(snapshot, 0);
foreach (PageNumberField field in snapshot)
{
field.NumberFormat = NumberFormat.ArabicNumbers;
}textControl.HeadersAndFooters.Add(HeaderFooterType.Footer)
Dim footer As HeaderFooter = textControl.HeadersAndFooters.GetItem(HeaderFooterType.Footer)
Dim fields As PageNumberFieldCollection = footer.PageNumberFields
fields.Add(New PageNumberField())
Dim snapshot(fields.Count - 1) As PageNumberField
fields.CopyTo(snapshot, 0)
For Each field As PageNumberField In snapshot
field.NumberFormat = NumberFormat.ArabicNumbers
Next