Why readonly and volatile modifiers are mutually exclusive?
问题 I have a reference-type variable that is readonly , because the reference never change, only its properties. When I tried to add the volatile modifier to it the compiled warned me that it wouldn't let both modifiers apply to the same variable. But I think I need it to be volatile because I don't want to have caching problems when reading its properties. Am I missing anything? Or is the compiler wrong? Update As Martin stated in one of the comments below: Both readonly and volatile modifiers