src/Foundation/Data/Gimela.Data.DataStructures/Collections/BidirectionalCollection.cs
/// <summary>
/// Tries to add the pair to the dictionary.
/// Returns false if either element is already in the dictionary        
/// </summary>
/// <param name="first"></param>
/// <param name="second"></param>
/// <returns>true if successfully added, false if either element are already in the dictionary</returns>
Tries to add the pair to the dictionary.
Returns false if either element is already in the dictionary
Tries to add the pair to the dictionary . Returns false if either element is already in the dictionary
public bool TryAdd(TFirst first, TSecond second)
    {
      if (firstToSecond.ContainsKey(first) || secondToFirst.ContainsKey(second))
        return false;
      firstToSecond.Add(first, second);
      secondToFirst.Add(second, first);
      return true;
    }
public bool TryAdd ( TFirst first , TSecond second ) { if ( firstToSecond . ContainsKey ( first ) || secondToFirst . ContainsKey ( second ) ) return false ; firstToSecond . Add ( first , second ) ; secondToFirst . Add ( second , first ) ; return true ; }
Tries to add the pair to the dictionary.
Tries to add the pair to the dictionary .
true if successfully added, false if either element are already in the dictionary
true if successfully added false if either element are already in the dictionary
first
TFirst
None
second
TSecond
None