public static T GetData <T>(string entryName, bool removeEntry = false) { object ob; if (OCBSession.TryGet(entryName, out ob, removeEntry)) { DataWidthKey ret = ob as DataWidthKey; if (ret != null) { return((T)ret.Data); } else { return((T)ob); } } return(default(T)); }
public static T GetDataWithKey <T>(string sessionName, object key, bool removeIfKeyNotMatch = true, bool removeSession = false) { object ob = null; if (OCBSession.TryGet(sessionName, out ob, removeSession)) { DataWidthKey dw = ob as DataWidthKey; if (dw != null) { if (dw.Key.Equals(key)) { return((T)dw.Data); } else if (!removeSession && removeIfKeyNotMatch) { OCBSession.Remove(sessionName); } } } return(default(T)); }