Show / Hide Table of Contents

Class ThreadSafeBidirectionalMap<TKey, TVal>

Inheritance
System.Object
ThreadSafeBidirectionalMap<TKey, TVal>
Implements
IBidirectionalMap<TKey, TVal>
System.Collections.Generic.IDictionary<TKey, TVal>
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TVal>>
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TVal>>
System.Collections.IEnumerable
Namespace: Eco.Core.Utils
Assembly: Eco.Core.dll
Syntax
public class ThreadSafeBidirectionalMap<TKey, TVal> : Object, IBidirectionalMap<TKey, TVal>, IDictionary<TKey, TVal>, ICollection<KeyValuePair<TKey, TVal>>, IEnumerable<KeyValuePair<TKey, TVal>>, IEnumerable
Type Parameters
Name Description
TKey
TVal

Constructors

ThreadSafeBidirectionalMap()

Declaration
public ThreadSafeBidirectionalMap()

Properties

Count

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32

IsReadOnly

Declaration
public bool IsReadOnly { get; }
Property Value
Type Description
System.Boolean

Item[TKey]

Declaration
public TVal this[TKey key] { get; set; }
Parameters
Type Name Description
TKey key
Property Value
Type Description
TVal

Keys

Declaration
public ICollection<TKey> Keys { get; }
Property Value
Type Description
System.Collections.Generic.ICollection<TKey>

Snapshot

Declaration
public ThreadSafeBidirectionalMap<TKey, TVal>.State Snapshot { get; }
Property Value
Type Description
ThreadSafeBidirectionalMap.State<>

Values

Declaration
public ICollection<TVal> Values { get; }
Property Value
Type Description
System.Collections.Generic.ICollection<TVal>

Methods

Add(TKey, TVal)

Declaration
public void Add(TKey key, TVal value)
Parameters
Type Name Description
TKey key
TVal value

Add(KeyValuePair<TKey, TVal>)

Declaration
public void Add(KeyValuePair<TKey, TVal> item)
Parameters
Type Name Description
System.Collections.Generic.KeyValuePair<TKey, TVal> item

Clear()

Declaration
public void Clear()

Contains(KeyValuePair<TKey, TVal>)

Declaration
public bool Contains(KeyValuePair<TKey, TVal> item)
Parameters
Type Name Description
System.Collections.Generic.KeyValuePair<TKey, TVal> item
Returns
Type Description
System.Boolean

ContainsKey(TKey)

Declaration
public bool ContainsKey(TKey key)
Parameters
Type Name Description
TKey key
Returns
Type Description
System.Boolean

ContainsValue(TVal)

Declaration
public bool ContainsValue(TVal val)
Parameters
Type Name Description
TVal val
Returns
Type Description
System.Boolean

CopyTo(KeyValuePair<TKey, TVal>[], Int32)

Declaration
public void CopyTo(KeyValuePair<TKey, TVal>[] array, int arrayIndex)
Parameters
Type Name Description
System.Collections.Generic.KeyValuePair<TKey, TVal>[] array
System.Int32 arrayIndex

GetEnumerator()

Declaration
public ImmutableDictionary<TKey, TVal>.Enumerator GetEnumerator()
Returns
Type Description
System.Collections.Immutable.ImmutableDictionary.Enumerator<>

GetOrAdd(TKey, TVal)

Thread-safe implementation of GetOrAdd pattern.

Declaration
public TVal GetOrAdd(TKey key, TVal value)
Parameters
Type Name Description
TKey key
TVal value
Returns
Type Description
TVal

GetOrAdd(TKey, Func<TVal>)

Thread-safe implementation of GetOrAdd pattern with valueFactory. Please be aware that valueFactory may be called even when value not inserted, because of nature of lock-free algorithms.

Declaration
public TVal GetOrAdd(TKey key, Func<TVal> valueFactory)
Parameters
Type Name Description
TKey key
System.Func<TVal> valueFactory
Returns
Type Description
TVal

Remove(TKey)

Declaration
public bool Remove(TKey key)
Parameters
Type Name Description
TKey key
Returns
Type Description
System.Boolean

Remove(KeyValuePair<TKey, TVal>)

Declaration
public bool Remove(KeyValuePair<TKey, TVal> item)
Parameters
Type Name Description
System.Collections.Generic.KeyValuePair<TKey, TVal> item
Returns
Type Description
System.Boolean

TryAdd(TKey, TVal)

Declaration
public bool TryAdd(TKey key, TVal value)
Parameters
Type Name Description
TKey key
TVal value
Returns
Type Description
System.Boolean

TryGetByValue(TVal, out TKey)

Declaration
public bool TryGetByValue(TVal value, out TKey key)
Parameters
Type Name Description
TVal value
TKey key
Returns
Type Description
System.Boolean

TryGetValue(TKey, out TVal)

Declaration
public bool TryGetValue(TKey key, out TVal value)
Parameters
Type Name Description
TKey key
TVal value
Returns
Type Description
System.Boolean

Implements

IBidirectionalMap<TKey, TVal>
System.Collections.Generic.IDictionary<, >
System.Collections.Generic.ICollection<>
System.Collections.Generic.IEnumerable<>
System.Collections.IEnumerable

Extension Methods

PropertyChanges.FirePropertyChanged(Object, String)
PropertyChanges.FirePropertyChanged(Object, String, Object, Object)
PropertyChanges.FirePropertyChanged(Object, MemberChangedBeforeAfterEventArgs)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾