We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8e6d355 commit e8d87d1Copy full SHA for e8d87d1
content/english/net/working-with-fields/delete-fields/_index.md
@@ -69,11 +69,7 @@ Replace `"YOUR DOCUMENT DIRECTORY"` with the actual path to your document direct
69
Iterate through all fields in the document and remove them:
70
71
```csharp
72
-for (int i = doc.Range.Fields.Count - 1; i >= 0; i--)
73
-{
74
- Field field = doc.Range.Fields[i];
75
- field.Remove();
76
-}
+doc.Range.Fields.ToList().ForEach(f => f.Remove());
77
```
78
79
This loop iterates backwards through the fields collection to avoid issues with modifying the collection while iterating.
0 commit comments