Example #1
0
 public static extern uint ValueEnumElements(ref JsonValue pval, KeyValueCallback penum, IntPtr param);
Example #2
0
        public static void LoopModifiable <TKey, TValue>(IDictionary <TKey, TValue> dictionary, KeyValueCallback <TKey, TValue> keyValueCallback)
        {
            if (dictionary == null || dictionary.Count == 0)
            {
                return;
            }
            Dictionary <TKey, TValue> cloneDict;

            if (dictionary is IdentityDictionary <TKey, TValue> )
            {
                cloneDict = new IdentityDictionary <TKey, TValue>(dictionary);
            }
            else
            {
                cloneDict = new Dictionary <TKey, TValue>(dictionary);
            }
            using (IEnumerator <KeyValuePair <TKey, TValue> > dictIter = cloneDict.GetEnumerator())
            {
                while (dictIter.MoveNext())
                {
                    KeyValuePair <TKey, TValue> entry = dictIter.Current;
                    keyValueCallback.Invoke(entry.Key, entry.Value);
                }
            }
        }
Example #3
0
 public static void Loop <TKey, TValue>(IEnumerator <KeyValuePair <TKey, TValue> > dictIter, KeyValueCallback <TKey, TValue> keyValueCallback)
 {
     try
     {
         while (dictIter.MoveNext())
         {
             KeyValuePair <TKey, TValue> entry = dictIter.Current;
             keyValueCallback.Invoke(entry.Key, entry.Value);
         }
     }
     finally
     {
         dictIter.Reset();
     }
 }
Example #4
0
 public static void Loop <TKey, TValue>(IDictionary <TKey, TValue> dictionary, KeyValueCallback <TKey, TValue> keyValueCallback)
 {
     if (dictionary == null)
     {
         return;
     }
     using (IEnumerator <KeyValuePair <TKey, TValue> > dictIter = dictionary.GetEnumerator())
     {
         while (dictIter.MoveNext())
         {
             KeyValuePair <TKey, TValue> entry = dictIter.Current;
             keyValueCallback.Invoke(entry.Key, entry.Value);
         }
     }
 }
Example #5
0
 public static extern uint ValueEnumElements(ref JsonValue pval, KeyValueCallback penum, IntPtr param);