/// <summary> /// 注册单例(每次注册将删除前一实例) /// </summary> /// <typeparam name="T"></typeparam> /// <param name="obj"></param> /// <param name="id"></param> public void RegSingle <T>(T obj, Guid id) { if (_Data.Contains(id.ToISFormatted())) { _Data.Remove(id.ToISFormatted()); } TicketedObject <T> tObject = new TicketedObject <T>(obj, id) { Strategy = TicketedObject.StrategyEnum.Single }; lock (_Locker) { _Data.Add <TicketedObject <T> >(tObject, id.ToISFormatted()); } }
public bool ShareTo <T>(TypedHashtable target, string sourceKey = null, string targetKey = null) { if (!Contains <T>(sourceKey)) { return(false); } target.Add <T>(Get <T>(sourceKey), targetKey); return(true); }
public List <T> Replace <T>(List <T> list) { _Lists.Add(typeof(T).Name, list); return(list); }