public V this[K key] { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return(UnsafeDictionary.Get <K, V>(m_inner, key)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] set { UnsafeDictionary.Set <K, V>(m_inner, key, value); } }
public void SetterTest() { var set = UnsafeDictionary.Allocate <int, int>(4); UnsafeDictionary.Add(set, 1, 1); UnsafeDictionary.Add(set, 7, 2); // Add new key UnsafeDictionary.Set(set, 2, 412); Assert.IsTrue(UnsafeDictionary.TryGetValue <int, int>(set, 2, out int valNew)); Assert.AreEqual(412, valNew); // Overwrite existing key UnsafeDictionary.Set(set, 1, 333); Assert.IsTrue(UnsafeDictionary.TryGetValue <int, int>(set, 1, out int valExist)); Assert.AreEqual(333, valExist); }