CSharp examples for System.Collections.Generic:IDictionary
Check if a dictionary contains all the items from another dictionary.
using System.Collections.Generic; public class Main{ /// <summary> /// Check if a dictionary contains all the items from another dictionary. /// </summary> public static bool ContainsAllItemsFrom<T1, T2>(this IDictionary<T1, T2> dic1, IDictionary<T1, T2> dic2) {/*from w ww . j a v a 2 s. co m*/ foreach (var curr1 in dic1) { if (!dic2.ContainsKey(curr1.Key)) return false; var curr2 = dic2[curr1.Key]; if (!curr1.Equals(curr2)) return false; } return true; } }