C# 自动实现的静态属性是线程安全的吗? [英] Are C# auto-implemented static properties thread-safe?
本文介绍了C# 自动实现的静态属性是线程安全的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道C#是否自动实现了属性,比如public static T Prop { get;放;}
,线程安全与否.谢谢!
I would like to know if C# automatically implemented properties, like public static T Prop { get; set; }
, are thread-safe or not. Thanks!
推荐答案
看来不是.这是使用 Reflector 的反编译:
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屋!
查看全文