I'm having problems with a passing a referance in a foreach loop.
"Cannot pass 'currentphoto' as a ref or out argument because it is a 'foreach iteration variable'"
foreach(photo currentphoto in thephotos){
panel1.Controls.Add(new thumbnailPicture(ref currentphoto));
}
I'm 100% sure that passing by referance would be the right way to elegantly deal with this. I need to basically expand this list into a panel which displays slots for each photo. Users can then drag photos into the slots.
Each slot holds a referance to a photo. So when users update a slot I want to change the details for the photo in the list. Then if the user does something else I can just dispose or clear the panel
The problem seems to be just the fact that it's in a foreach loop.
(I have tried turning it into a while loop and using ref thephotos[x] and that gives the same error but complaining that it's an array value instead)
Thanks in advance
Chris