1
我想知道在Mono for Android應用程序中使用靜態變量作爲業務實體的長期存儲是否安全。Monodroid中的靜態變量
舉例來說,如果我有這個類:
public class Test{
public static int MyStaticVariable{get;set;}
}
,並在我的主要活動我有這樣的代碼
protected override void OnCreate(Bundle bundle)
{
...
if (Test.MyStaticVariable){
Test.MyStaticVariable=666;
}
}
我可以永遠依靠Test.MyStaticVariable==666
或將這個值是最終被重置操作系統,當我的應用程序超出範圍和內存必須回收?
感謝,
阿德里安