A simple question, I think, but what is the difference between these lines of code:
Code 1
public int Temp { get; set; }
and
Code 2
private int temp;
public int Temp { get { return temp; } }
I understand that the automatic property in accordance with code 1 will perform the same function as code 2?
I read Head First C # and it’s hard for me to understand why it uses two different ways to do the same?
source
share