ACR_ServerMisc.ACR_ServerMisc.DictionaryIterateFirst C# (CSharp) Method

DictionaryIterateFirst() private method

Set Dictionary Iterator to first Key-Value pair and return its Key.
private DictionaryIterateFirst ( string DictID, string &Key ) : bool
DictID string Supplies the id of the Dictionary to access. ///
Key string Output is the first Key in the SortedDictionary. ///
return bool
        private bool DictionaryIterateFirst(string DictID, out string Key)
        {
            SortedDictionary<string, string> Dict;
            IDictionaryEnumerator ide;

            Key = "";

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

            ide = Dict.GetEnumerator();

            // Confirm there exists an element within this dictionary,
            // if not simply return false
            if (ide.MoveNext() == false)
                return false;

            Key = (string)ide.Key;

            // Store iterator for future use
            StorageIteratorList[DictID] = ide;

            return true;
        }