Closed
Description
Hello,
Parallel.Foreach documentation could discuss the issue of captured variables in a loop - whether each iteration gets its own variables or if the developer has any concerns about sharing. From the code example, it appears that the developer need not create their own copy of currentFile within the loop.
https://stackoverflow.com/questions/271440/captured-variable-in-a-loop-in-c-sharp
Best regards.
-John
[Enter feedback here]
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 25dcc671-50d5-032b-735c-2ac9b6a21338
- Version Independent ID: c70450e1-1006-7478-fcca-45c8bfbe2c09
- Content: Write a simple parallel program using Parallel.ForEach
- Content Source: docs/standard/parallel-programming/how-to-write-a-simple-parallel-foreach-loop.md
- Product: dotnet
- Technology: dotnet-standard
- GitHub Login: @IEvangelist
- Microsoft Alias: dapine