class MyClass{ public int MyProperty { get { /* ... */ } set { /* ... */ } } public int MyField; public void MyMethod( ref int n ) { /* Do something with n */ } public void MyTest() { MyMethod( ref MyField ); // Works fine MyMethod( ref MyProperty ); // Uh oh! }}
public void MyTest(){ MyMethod( ref MyField ); // Still fine int temp = 0; MyMethod( ref temp ); MyProperty = temp;}
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.