(In the following code, player
is a of a type which contains a Vector2
called Vector
)
Vector2 v = player.Vector;
v.X -= player.Speed * (float)gameTime.ElapsedGameTime.TotalSeconds;
player.Vector = v;
vs.
player.Vector = new Vector2(player.Vector.X - player.Speed * (float)gameTime.ElapsedGameTime.TotalSeconds, player.Vector.Y);
These both accomplish the same task (Getting around the "Cannot modify the return value because it is not a variable" Error), but is one more efficient than the other?
Does one use less memory? (No, right?) Does one execute quicker? Is there a better way?