Answer the question
In order to leave comments, you need to log in
Reusing variables?
For example, I have a method
Vector2 getSomePoint(){
return new Vector2(x,y);
}
Answer the question
In order to leave comments, you need to log in
Vector2 is a value-type, structure, it is allocated either in the memory of the aggregating object or on the stack.
new in C# doesn't mean it's a heap allocation.
Write as you wrote, everything is in order.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question