Skip to content

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

Merged
yowl merged 1 commit intobytecodealliance:mainfrom
andreakarasho:patch-2
Feb 26, 2026
Merged

[C#] Remove 'readonly' from struct and field definitions#1546
yowl merged 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
Copy link
Collaborator

@yowl yowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Thanks.

@yowl yowl added this pull request to the merge queue Feb 26, 2026
Merged via the queue into bytecodealliance:main with commit 18f858a Feb 26, 2026
27 checks passed
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.

2 participants