In C#, I have a struct like this:
public struct Slab { public float[] sizeM; public string textureSrc; //more members, not relevant here... } And another like this:
public struct Tombstone { public Slab mainSlab; public Slab? basing; //more... } Now, I want to modify members of basing:
uiState[0].stone.basing.Value.sizeM[2] = Int32.Parse(breadthField.Value) / 100.0f; uiState[0].stone.basing.Value.textureSrc = fileName; (uiState[0].stone is of type Tombstone)
First of these two calls works correctly, as I'm just changing a member of the array in basing, not the array itself. However, the second complains:
Cannot modify the return value of 'Slab?.Value' because it is not a variable It works if I do the same to mainSlab which is not nullable. Is there a way to do this without copying the whole basing to a local variable for changes?