According to the docs: http://msdn.microsoft.com/en-us/library/x13ttww7.aspx:
The volatile keyword can be applied to reference types.
So why is it illegal to use on a Nullable<T>.. a reference type!
Please note that I do not actually need volatile semantics on a Nullable<T> field, I encountered this error accidentally and am simply curious.
Nullable<T>isn’t a reference type. It’s a value type:Note the
structpart.Just because it has a
nullvalue doesn’t make it a reference type… it’s a nullable value type. See section 4.1.10 of the C# 4 language spec for more details.