Show / Hide Table of Contents

Interface IBidirectionalMap<TKey, TVal>

Interface for bi-directional maps which allow to access key by value in addition to usual by key lookup.

Namespace: Eco.Shared.Utils
Assembly: Eco.Shared.dll
Syntax
public interface IBidirectionalMap<TKey, TVal> : IDictionary<TKey, TVal>, ICollection<KeyValuePair<TKey, TVal>>, IEnumerable<KeyValuePair<TKey, TVal>>, IEnumerable
Type Parameters
Name Description
TKey
TVal

Methods

ContainsValue(TVal)

Checks if value is in map.

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

GetOrAdd(TKey, TVal)

Gets value by key or adds new mapping if not exits.

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

GetOrAdd(TKey, Func<TVal>)

Gets value by key or adds new mapping if not exits. Value will be created with valueFactory.

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

TryAdd(TKey, TVal)

Tries to add two-way mapping between key and value. Fails if either key or value already exists in the dictionary.

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

TryGetByValue(TVal, out TKey)

Lookups key by value.

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

Extension Methods

CommandLine.FeedFromCommandLine(Object)
CommandLine.ToCommandLineArgs(Object, Func<Object, Boolean>)
ListUtil.DepthFirstTraversal<T>(T, Func<T, IEnumerable<T>>)
EnumerableExtensions.SingleItemAsEnumerable<T>(T)
EventUtils.RaiseEvent<TEventArgs>(Object, String, TEventArgs)
PredicateUtils.MatchesAll<TEnumerable, T>(T, TEnumerable)
PredicateUtils.MatchesAll<T>(T, Func<T, Boolean>[])
PredicateUtils.MatchesAny<TEnumerable, T>(T, TEnumerable)
ReflectionUtils.PropertyValue<T>(Object, PropertyInfo)
ReflectionUtils.TryGetPropertyValueByName<T>(Object, String, out T)
ReflectionUtils.GetPropertyValueByName<T>(Object, String)
ReflectionUtils.SetPropertyByName(Object, String, Object)
ReflectionUtils.GetStructPropertyByName<T>(Object, String)
ReflectionUtils.GetStringPropertyByName(Object, String)
ReflectionUtils.ZipByProperty<T>(Object, Object, Object, Func<T, T, T>)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾