This is a kind of noob question. I have a simple property
bool IsRoot { get { return parent==null; } }
which I call many times from other properties and methods in the class (and derived classes)
I like to keep it this way because it makes the code readable (for me), but I'm afraid that all the calls IsRootwill interfere with me, because they cannot be “embedded” in the final version of the code. What I mean by inlined is that get_IsRoot()instead get_IsRoot()they are replaced by a copy of the grade parent==null.
Can someone explain to me when (or if) properties are built into C #, and for performance-oriented applications, properties that should be avoided or not?
EDIT_1 : Short answer: properties translate to pure function calls, and they may or may not be nested depending on what JIT solves. Trust the system to make the right choice, and don’t worry about things that can affect things at 5% -10% unless the profiler is used and the end result is precisely tuned for performance.
Thanks for contacting the SO community, and I hope there was a way to award some correct answers. Sorry, I had to choose one.
source
share