I would like to know the simplest code for polling a property\'s value, to execute the code in its getter. Currently I\'m using: instance.property.ToString();
instance.property.ToString();
I like Jon Skeet's answer, but along the same vein, this would also work without having to write an extension method:
GC.KeepAlive(instance.SomeProperty);
The KeepAlive method accepts an object and does nothing with it, like the NoOp extension method.
KeepAlive
object
NoOp