In .Net many classes are thread-safe if they are static, how is that implemented?

157 Views Asked by At

For many classes in the .NET frameworks, MSDN describes thead safety as:

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

How is that implemented? is there a syntactic sugar that happens there? or is it implemented inside the class in some way?

Thanks.

1

There are 1 best solutions below

3
Knaģis On BEST ANSWER

That is just an implementation detail of those classes. It just means that the developers for those static methods took care of any thread-safety issues.

It is not a language or framework feature that static methods are thread-safe.