public TMappedType GetOrCreateItem(THandle handle, Action <THandle> foundHandleRelease = default) { if (HandleMap.TryGetValue(handle, out TMappedType retVal)) { foundHandleRelease?.Invoke(handle); return(retVal); } retVal = ItemFactory(handle); HandleMap.Add(handle, retVal); return(retVal); }
public TMappedType GetOrCreateItem(THandle handle, Action <THandle>?foundHandleRelease = null) { handle.ValidateNotDefault(nameof(handle)); if (HandleMap.TryGetValue(handle, out TMappedType retVal)) { foundHandleRelease?.Invoke(handle); return(retVal); } retVal = ItemFactory(handle); HandleMap.Add(handle, retVal); return(retVal); }