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 GetterTest() { var set = UnsafeDictionary.Allocate <int, int>(4); UnsafeDictionary.Add(set, 1, 1); UnsafeDictionary.Add(set, 7, 2); UnsafeDictionary.Add(set, 51, 3); UnsafeDictionary.Add(set, 13, 4); // Get non-existent key Assert.Throws <ArgumentException>(() => { UnsafeDictionary.Get <int, int>(set, 2); }); // Get existing key var value = UnsafeDictionary.Get <int, int>(set, 51); Assert.AreEqual(3, value); }