Пример #1
0
 public void Remove(THandle handle)
 {
     if (HandleMap.TryGetValue(handle, out TMappedType item))
     {
         HandleMap.Remove(handle);
         DisposeItem(item);
     }
 }
Пример #2
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);
        }
Пример #3
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);
        }
Пример #4
0
 public bool FindCharacteristicByHandle(ushort handle, out BlePeripheralCharacteristic characteristic)
 {
     return(HandleMap.TryGetValue(handle, out characteristic));
 }