Suppose I have an object:
public class A
{
private int m_a;
private int m_b;
A(int a, int b)
{
m_a = a;
m_b = b;
}
}
This gets the job done but I have a hazy memory of being told it unnecessarily copies the integers into arguments a and b and then into m_a and m_b. Is there a way to define the class such that the parameters pass straight through to their member counterparts?
Please note that I don't want to discuss C# Object Constructor - shorthand property syntax as here the onus is upon the person using the class.
Of course I could be entirely wrong and maybe the compiler removes such trivialities thus I should be happy to be educated either way.