是否有一个属性标记的类或方法是线程安全的。NET? [英] Is there an attribute to mark the class or method to be thread safe in .NET?

查看:102
本文介绍了是否有一个属性标记的类或方法是线程安全的。NET?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在.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.

这篇关于是否有一个属性标记的类或方法是线程安全的。NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆