是C#自动实现静态属性是线程安全的? [英] Are C# auto-implemented static properties thread-safe?
本文介绍了是C#自动实现静态属性是线程安全的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如果C#自动实现属性,例如公共静态牛逼道具{搞定;组; }
,是线程安全与否。谢谢!
I would like to know if C# automatically implemented properties, like public static T Prop { get; set; }
, are thread-safe or not. Thanks!
推荐答案
这似乎并非如此。这与反射器编译:
It appears not. This is the decompilation with Reflector:
private static string Test
{
[CompilerGenerated]
get
{
return <Test>k__BackingField;
}
[CompilerGenerated]
set
{
<Test>k__BackingField = value;
}
}
这篇关于是C#自动实现静态属性是线程安全的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文