public V this[K key]
 {
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
     get { return(UnsafeSortedDictionary.Get <K, V>(m_inner, key)); }
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
     set { UnsafeSortedDictionary.Set <K, V>(m_inner, key, value); }
 }
예제 #2
0
        public void SetterTest()
        {
            var set = UnsafeSortedDictionary.Allocate <int, int>(4);

            UnsafeSortedDictionary.Add(set, 1, 1);
            UnsafeSortedDictionary.Add(set, 7, 2);

            // Add new key
            UnsafeSortedDictionary.Set(set, 2, 412);
            Assert.IsTrue(UnsafeSortedDictionary.TryGetValue <int, int>(set, 2, out int valNew));
            Assert.AreEqual(412, valNew);

            // Overwrite existing key
            UnsafeSortedDictionary.Set(set, 1, 333);
            Assert.IsTrue(UnsafeSortedDictionary.TryGetValue <int, int>(set, 1, out int valExist));
            Assert.AreEqual(333, valExist);
        }