public static extern uint ValueEnumElements(ref JsonValue pval, KeyValueCallback penum, IntPtr param);
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); } } }
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(); } }
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); } } }