コード例 #1
0
        /// <summary>
        /// Delete value from dictionary by key.
        /// </summary>
        /// <param name="DictID">Supplies the id of the Dictionary to access.
        /// </param>
        /// <param name="Key">Key to search for and delete from the dictionary.
        /// </param>
        private void DictionaryDeleteKey(string DictID, string Key)
        {
            SortedDictionary <string, string> Dict;

            if (StorageList.TryGetValue(DictID, out Dict) == false)
            {
                return;
            }

            Dict.Remove(Key);
            StorageIteratorList.Remove(Key);
        }
コード例 #2
0
        /// <summary>
        /// Set Dictionary DictID's Key to a String Value.
        /// </summary>
        /// <param name="DictID">Supplies the id of the Dictionary to access.
        /// If this Dictionary does not exist, create it. </param>
        /// <param name="Key">Supplies the Key for lookup of the target dictionary.
        /// If no such Key exists, create a new Key/Value pair. </param>
        /// <param name="Value">Supplies the Value to associate to the Key in the
        /// target dictionary. </param>
        private void DictionarySetString(string DictID, string Key, string Value)
        {
            SortedDictionary <string, string> Dict;

            // Create if does not exist
            if (StorageList.TryGetValue(DictID, out Dict) == false)
            {
                Dict = new SortedDictionary <string, string>();
                StorageList[DictID] = Dict;
            }

            Dict[Key] = Value;
            StorageIteratorList.Remove(DictID);
        }
コード例 #3
0
        /// <summary>
        /// Advance Dictionary Iterator to next Key-Value pair and return its Key.
        /// </summary>
        /// <param name="DictID">Supplies the id of the Dictionary to access.
        /// </param>
        /// <param name="Key">Output is the first Key in the SortedDictionary.
        /// </param>
        /// <returns>True if Dictionary DictID exists (and its iterator has been
        /// properly initialized with DictionaryIterateFirst) and the next
        /// Key-Value pair exists, otherwise false.</returns>
        private bool DictionaryIterateNext(string DictID, out string Key)
        {
            IDictionaryEnumerator ide;

            Key = "";

            if (StorageIteratorList.TryGetValue(DictID, out ide) == false)
            {
                return(false);
            }

            // If another element does not exist, return false
            if (ide.MoveNext() == false)
            {
                StorageIteratorList.Remove(DictID);
                return(false);
            }

            Key = (string)ide.Key;

            return(true);
        }
コード例 #4
0
 /// <summary>
 /// Delete entire contents of dictionary by dictionary id.
 /// </summary>
 /// <param name="DictID">Supplies the id of the Dictionary to access.
 /// </param>
 private void DictionaryClear(string DictID)
 {
     StorageList.Remove(DictID);
     StorageIteratorList.Remove(DictID);
 }