Skip to content

[C#] Remove 'readonly' from struct and field definitions#1546

Open
andreakarasho wants to merge 1 commit intobytecodealliance:mainfrom
andreakarasho:patch-2
Open

[C#] Remove 'readonly' from struct and field definitions#1546
andreakarasho wants to merge 1 commit intobytecodealliance:mainfrom
andreakarasho:patch-2

Conversation

@andreakarasho
Copy link
Contributor

The host pass a vector of Velocity to the guest.
You want to change only the X.
Today you have to re-assign each index like:

readonly struct Velocity { public readonly float X, Y; }
...
velocities[i] = new Velocity(velocities[i].X + 1, velocities[i].Y);

Removing the readonly you can simply do:

struct Velocity { public float X, Y; }
...
velocities[i].X += 1;

@andreakarasho andreakarasho changed the title Remove 'readonly' from struct and field definitions [C#] Remove 'readonly' from struct and field definitions Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments