How do you link together two struct-type variables together in c#?

Viewed 226

My question is simple; how can I link together two structs so that modifying one changes the other in c#? Is this even possible due to the nature of structs?

In code, this is what I'm trying to accomplish:

Vector2 a = new Vector2(0.5f, 0.7f);
Vector2 b = a; // This line needs changing
b.X = 1.0f;
Debug.WriteLine(a.X); // should print 1.0f, but actually prints 0.5f.

For context, I'm making a game in MonoGame and need to link sprite positions together, which naturally use the built-in datatype "Vector2", which is a struct.

1 Answers
Related