P
Patrick
Is the following use of static variable and method "safe"? It is in a Class
Library that is invoked from an ASP.NET User Control of many ASP.NET pages?
It seems to be working, but I recall having some obscure issues with the
initialisation of "shared" variables in VB.NET with old .NET 1.0 (the
following is .NET 1.1 on Win2K SP4).
public class Constants
{
//The static variable in question
private static Hashtable colLookupValues;
public Constants()
{
}
//The static method in question
public static ArrayList getHashValue(string strKey)
{
ArrayList colHashValues = new ArrayList();
string strCurHashKey = strKey;
//Is this OK?
if (colLookupValues==null)
{
colLookupValues = new Hashtable();
colLookupValues.Add(KEY1,OBJ1);
colLookupValues.Add(OBJ1,OBJ2);
colLookupValues.Add(OBJ2,OBJ3);
}
//Do Lookup and return a list
} //end function getHashValue
}
}
Library that is invoked from an ASP.NET User Control of many ASP.NET pages?
It seems to be working, but I recall having some obscure issues with the
initialisation of "shared" variables in VB.NET with old .NET 1.0 (the
following is .NET 1.1 on Win2K SP4).
public class Constants
{
//The static variable in question
private static Hashtable colLookupValues;
public Constants()
{
}
//The static method in question
public static ArrayList getHashValue(string strKey)
{
ArrayList colHashValues = new ArrayList();
string strCurHashKey = strKey;
//Is this OK?
if (colLookupValues==null)
{
colLookupValues = new Hashtable();
colLookupValues.Add(KEY1,OBJ1);
colLookupValues.Add(OBJ1,OBJ2);
colLookupValues.Add(OBJ2,OBJ3);
}
//Do Lookup and return a list
} //end function getHashValue
}
}