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

25th Jul 2018, 3:57 PM
Robert
1 Odpowiedź
+ 1
Wow! This question is unanswered for 2 years!!!
5th Apr 2021, 8:26 AM
Michael
Michael - avatar