0
Is there any reason to write set { value = num; }?
Is there any reason instead to write set { num = value; } / set { value = num; } public class SomeData { private int num = 1; public int numGetSet { get { return num; } set { value = num; } // { num = value; } can also be written } } void Start () { SomeData sNewData = new SomeData(); int num1 = 2; sNewData.numGetSet = sNewData.numGetSet + num1; // Output is: 1 i just ask because i switch by mistake set { value = num; } // { num = value; } and i was a bit surprised, that this way is also working ... Cheers Robert
1 Resposta
+ 1
Wow! This question is unanswered for 2 years!!!