I had this code :
foreach (object obj in _Destinations)
{
obj = _ItemsSource;
}
which was generating the error
Cannot assign to 'obj' because it is a 'foreach iteration variable'
So I "circled" the problem with the following code :
for (int i = 0; i < _Destinations.Count; i++)
{
_Destinations[i] = _ItemsSource;
}
This works on my actual cases but I'm not sure that this is the exact same thing for any type of object. Is that the case ?
EDIT : _Destinations is a List<object>