Frans, I dont know if its right or not. I implemented those 2 Hashtables as protected, then I exposed the rows as separate public properties and it worked for me. See code & please comment:
protected static Hashtable CachedObjects = new Hashtable();
protected static Hashtable CachedFlags = new Hashtable();
public enum EnumCachedIndices {agentName,agentAddress,agentBG,agentLogo};
.....
public string AgentName
{
get{
if (AgentNameFlag) {
CacheManager.CachedObjects[EnumCachedIndices.agentName] = GetAgentName();
AgentNameFlag = false;
return CacheManager.CachedObjects[EnumCachedIndices.agentName].ToString();
}
set
{
CacheManager.CachedObjects[EnumCachedIndices.agentName] = value;
AgentNameFlag = true;
}
}
protected bool AgentNameFlag
{
get {
if (CacheManager.CachedFlags[EnumCachedIndices.agentName] != null) {
return (bool)CacheManager.CachedFlags[EnumCachedIndices.agentName];
}
else{
CacheManager.CachedFlags[EnumCachedIndices.agentName] = true;
return (bool)CacheManager.CachedFlags[EnumCachedIndices.agentName];
}
set{
CacheManager.CachedFlags[EnumCachedIndices.agentName] = value;
}
}
My question is, is it good to expose the whole Hashtable CachedObjects ? If this is the case, then what do I do to accomplish this?
Thanks for all inputs.
P.S: I know its another friday, but a job is a job is a job! ah well,
~ Uy