Cannot assign to 'obj' because it is a 'foreach iteration variable'
I asked during a job interview is there a difference between for to foreach are not in terms of performance in terms of working with objects. Can I update the same set of both? Desalination to see which candidate did not know the answer. I'm not going to explain who was stronger for or foreach . That you can read the article by Dustin Campbell - Performance of foreach vs. List.ForEach . So I'll give a practical example, explain the difference from for to foreach when both cases I'm going to update my system. Here's the code for example: Is for or/and foreach will update the List ? using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; namespace CheckFor { class Program { static void Main( string [] args) ...