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); }
 }
Beispiel #2
0
        public void GetterTest()
        {
            var set = UnsafeSortedDictionary.Allocate <int, int>(4);

            UnsafeSortedDictionary.Add(set, 1, 1);
            UnsafeSortedDictionary.Add(set, 7, 2);
            UnsafeSortedDictionary.Add(set, 51, 3);
            UnsafeSortedDictionary.Add(set, 13, 4);

            // Get non-existent key
            Assert.Throws <ArgumentException>(() =>
            {
                UnsafeSortedDictionary.Get <int, int>(set, 2);
            });

            // Get existing key
            var value = UnsafeSortedDictionary.Get <int, int>(set, 51);

            Assert.AreEqual(3, value);
        }