コード例 #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
ファイル: BlePeripheralMap.cs プロジェクト: tyounsi/monomyo
 public bool FindCharacteristicByHandle(ushort handle, out BlePeripheralCharacteristic characteristic)
 {
     return(HandleMap.TryGetValue(handle, out characteristic));
 }