我有这个对象,许多insrance使用不同的线程:
Private static var _selectedIntrerface;
public static Interfaces SelectedIntrerface
{
get { return _selectedIntrerface; }
set { _selectedIntrerface= value; }
}
所以我的问题很简单:我应该这样宣布:
Private static volatile var _selectedIntrerface;
public static volatile Interfaces SelectedIntrerface
{
get { return _selectedIntrerface; }
set { _selectedIntrerface= value; }
}
此对象未经修改,仅被访问。