OK, I just did some testing of my own and it seems that you can set fields/properties of reference types, i.e. classes, in a foreach loop like that but you can't do so with value types, i.e. structures. Thus I assume that your Room type is a structure.

This is explained by the fact that in your code q will be a copy of the actual value in the array, so setting its fields/properties is pointless because it will not affect the original. If you want to change fields/properties of an array of structures then use a for loop instead of a foreach loop: