Is there any way in C# to mark a property as deterministic?
The reason I ask is that I often find myself declaring a local variable and reading a property into it, instead of accessing the property multiple times.
Is there any way that I can decorate the property as deterministic, such that the compiler could then optimize multiple accesses to that property? I am guessing in such a scenario that the class would need to be immutable, and decorated as such.
Is this something that even exists or am I clutching at straws?