Hi,
This is not really a bug, rather an inconsistency.
Expected Behavior
Accessing the collection using the enumerator should return the same type as accessing it using the index.
Actual Behavior
- Accessing elements of a PdfAcroFieldCollection using the index will return the element as PdfAcroField.
- Using the enumerator will return the element as PdfItem.
The issue is that there is no way to convert the PdfItem to PdfAcroField since the method used for the conversion is not accessible and PdfAcroField subtypes' constructor are internal.
Steps to Reproduce the Behavior
Compare iterating over the collection using a for loop and a foreach loop. The variable item has a different type.
for (int i = 0; i < acroFieldCollection.Count; i++) {
PdfAcroField item = acroFieldCollection[i];
// do something with the item
}
foreach (PdfItem item in acroFieldCollection) {
// do something with the item
}
Hi,
This is not really a bug, rather an inconsistency.
Expected Behavior
Accessing the collection using the enumerator should return the same type as accessing it using the index.
Actual Behavior
The issue is that there is no way to convert the PdfItem to PdfAcroField since the method used for the conversion is not accessible and PdfAcroField subtypes' constructor are internal.
Steps to Reproduce the Behavior
Compare iterating over the collection using a for loop and a foreach loop. The variable item has a different type.