I'm pretty new to writing C#, but I've come to understand that Properties are just syntactic sugar for writing getters and setters. So when the documentation states
Any public static members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
would it be correct to assume that this applies to properties as well? I.e. any static property woul开发者_StackOverflow社区d be guaranteed to be thread safe but not instance properties.
A member includes properties, fields and methods. So yes, a static member of the type if declared as such is threadsafe. As a property is a member, the static properties are threadsafe.
@Sehe has caught me on Events are also "members". Not sure what a threadsafe event would do though ;)
精彩评论