Ejemplo n.º 1
0
        public static bool EqualsDictionary <Key, Value>(this IDictionary <Key, Value> a, IDictionary <Key, Value> b, IList <Key> ignoreKeys)
        {
            var allkeys = new HashSetEx <Key>(a.Keys);

            allkeys.AddRange(b.Keys);
            foreach (Key key in allkeys)
            {
                if (ignoreKeys.Contains(key))
                {
                    continue;
                }
                if (!a.ContainsKey(key))
                {
                    return(false);
                }
                if (!b.ContainsKey(key))
                {
                    return(false);
                }
                if (!a[key].Equals(b[key]))
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
 public static void SaveLines(string path, HashSetEx <string> lines)
 {
     using (var sw = new StreamWriter(File.OpenWrite(path)))
     {
         foreach (string line in lines)
         {
             sw.WriteLine(line);
         }
     }
 }