how to destroy static variable?
The following is snippets of my code:
public class OrganizationLayerDetail : CBase
{
//an interface
private static volatile IOrganizationLayerDetail iBuilder = null;
private OrganizationLayerDetail( object AppServer, string language ) : base( AppServer, language )
{
iBuilder = CDC.PowerHRP.DALFactory.OrganizationLayerDetail.Cr eate(AppServer,Language);
}
private static void creatIbuilder( object AppServer, string language )
{
if(iBuilder == null){
lock(typeof(IOrganizationLayerDetail))
{
if(iBuilder == null)
{
new OrganizationLayerDetail(AppServer,language);
}
}
}
}
public static System.Data.DataRowCollection getDetail(string strCode, object AppServer, string language )
{
creatIbuilder(AppServer,language );
System.Data.DataRowCollection dst = iBuilder.getDetail(strCode,AppServer,language);
return dst;
}
}
I invoke "getDetail(...)" in my web form, when i first invoke it ,of course iBuilder is null , but when i closed the application, and restarted the application, iBuilder isn't null,why?
Expect for someone to help me to understand this, and give me a solution for this, thanks first!
|