Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Squeezing more performance from SortedList

, 10 Oct 2008 CPOL
A SortedList implementations using a cyclic algorithm and C# IDictionary tweaks.
SplitArrayDictionary_demo.zip
SplitArrayDictionary_bin
Debug
SplitArrayDictionary.exe
SplitArrayDictionary.vshost.exe
SplitArrayDictionary.vshost.exe.manifest
Release
SplitArrayDictionary.exe
SplitArrayDictionary_src.zip
SplitArrayDictionary_src
Properties
src
using System;
namespace SplitArrayDictionary
{

    /// <summary>
    /// Summary description for Class1
    /// </summary>
    public class StubDictionary<TValue>
        : System.Collections.Generic.IDictionary<int, TValue>
    {
        #region IDictionary<int,TValue> Members
        TValue lastValue;
        int lastint;
        public void Add(int key, TValue value)
        {
            lastValue = value;
            lastint = key;
        }

        public bool ContainsKey(int key)
        {
            if (key == lastint) return true;
            throw new NotImplementedException();
        }

        public System.Collections.Generic.ICollection<int> Keys
        {
            get { throw new NotImplementedException(); }
        }

        public bool Remove(int key)
        {
            throw new NotImplementedException();
        }

        public bool TryGetValue(int key, out TValue value)
        {
            if (key == lastint)
            {
                value = lastValue;
                return true;
            }

            throw new NotImplementedException();
        }

        public System.Collections.Generic.ICollection<TValue> Values
        {
            get { throw new NotImplementedException(); }
        }

        public TValue this[int key]
        {
            get
            {
                if (key == lastint)
                {
                    return lastValue;
                }

                throw new NotImplementedException();
            }
            set
            {
                this.lastint = key;
                this.lastValue = value;
            }
        }

        #endregion

        #region ICollection<KeyValuePair<int,TValue>> Members

        public void Add(System.Collections.Generic.KeyValuePair<int, TValue> item)
        {
            throw new NotImplementedException();
        }

        public void Clear()
        {
            this.lastint = 0;
            this.lastValue = default(TValue);
        }

        public bool Contains(System.Collections.Generic.KeyValuePair<int, TValue> item)
        {
            throw new NotImplementedException();
        }

        public void CopyTo(System.Collections.Generic.KeyValuePair<int, TValue>[] array, int arrayIndex)
        {
            throw new NotImplementedException();
        }

        public int Count
        {
            get { return -1; }
        }

        public bool IsReadOnly
        {
            get { throw new NotImplementedException(); }
        }

        public bool Remove(System.Collections.Generic.KeyValuePair<int, TValue> item)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region IEnumerable<KeyValuePair<int,TValue>> Members

        public System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<int, TValue>> GetEnumerator()
        {
            throw new NotImplementedException();
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

itaifrenkel
Software Developer
Israel Israel
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150301.1 | Last Updated 10 Oct 2008
Article Copyright 2007 by itaifrenkel
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid