是否有一个属性标记的类或方法是线程安全的。NET?线程、有一个、标记、属性

2023-09-05 00:15:09 作者:回忆曾经寂如流年°

在.NET我怎么能知道,如果一个类或方法是线程安全与否?它是在默认情况下不是线程安全的?

In .NET how can I know if a class or method is thread safe or not? Is it by default not thread safe?

推荐答案

这是没有属性这一点:你必须阅读的每个项目感兴趣的文档通过添加你不能使一些线程安全的根本。归因于它。这就像把一个橘子,并把它的标签,上面写着,苹果。

This is no attribute for this: you have to read the documentation for each item your are interested in. You can't make something thread safe simply by adding an attribute to it. That's like taking an orange and putting a sticker on it that says, "Apple".

当然,同样的事情是真实的序列化,并没有阻止他们那里,但仍:无属性。阅读文档。

Of course, the same thing is true for serialization and it didn't stop them there, but still: no attribute. Read the docs.