Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }