public void AddIfNotExist(string key, Toc toc) { if (!_values.TryAdd(key, toc)) { _logger.Information("Duplicate Toc {key} new value not set {@toc}.", key, toc); } }
public void AddOrReplace(string key, Toc toc) { if (!_values.TryAdd(key, toc)) { _values[key] = toc; _logger.Information("Replace Toc {key}.", key); } }
public Toc FindOrAdd(string key) { if (!_values.TryGetValue(key, out var value)) { _logger.Information("{key} Toc not found. Creating.", key); var newValue = new Toc(key); value = _values.GetOrAdd(key, newValue); } return(value); }
public bool Equals(Toc other) { return(Code == other.Code); }
public bool IsValid(Toc toc) => NoFilter || Tocs.Contains(toc.Code);