我很想知道,在下面的代碼中,靜態實例是否可能是非空的,但MYDB類引用被GAC處置並設置爲null?靜態實例的對象引用問題
public class DA_Setting
{
private static readonly DA_Setting instance = new DA_Setting();
public static DA_Setting Instance
{
get { return instance; }
}
db MYDB = new db();
// Some other methods here
private void Getname()
{
MYDB.GetNames(); // Sometimes this line throws null reference error on LIVE server.
}
}
instance.MYDB.GetNames()? – Goran 2012-03-26 07:57:38
它進行數據庫調用。 – 2012-03-26 07:58:53
查看(或顯示)異常的堆棧跟蹤。 – Heinzi 2012-03-26 08:04:49