public void Remove(THandle handle) { if (HandleMap.TryGetValue(handle, out TMappedType item)) { HandleMap.Remove(handle); DisposeItem(item); } }
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); }
public bool FindCharacteristicByHandle(ushort handle, out BlePeripheralCharacteristic characteristic) { return(HandleMap.TryGetValue(handle, out characteristic)); }