Exemplo n.º 1
0
        /// <summary>
        /// Get a CSV containing all the entries of this CSV which do not correspond to entries in the Other CSV.
        /// </summary>
        /// <param name="Other"></param>
        /// <returns></returns>
        public CSV NotIn(CSV Other)
        {
            CSV newCSV = new CSV();

            List <String> CommonKeys = new List <string>();

            foreach (String key in AllKeys)
            {
                if (Other.AllKeys.Contains(key))
                {
                    CommonKeys.Add(key);
                }
            }

            foreach (Dictionary <String, String> row in _Data)
            {
                Dictionary <String, String> strippedRow = new Dictionary <string, string>();
                foreach (String key in CommonKeys)
                {
                    strippedRow.Add(key, row[key]);
                }

                if (!Other.Contains(strippedRow))
                {
                    newCSV.Add(row);
                }
            }

            return(newCSV);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get a CSV containing all the entries of this CSV which do not correspond to entries in the Other CSV.
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public CSV NotIn(CSV other)
        {
            CSV newCsv = new CSV();

            List <string> commonKeys = new List <string>();

            foreach (string key in AllKeys)
            {
                if (other.AllKeys.Contains(key))
                {
                    commonKeys.Add(key);
                }
            }

            foreach (Row row in _data)
            {
                Row strippedRow = new Row();
                foreach (string key in commonKeys)
                {
                    strippedRow.Add(key, row[key]);
                }

                if (!other.Contains(strippedRow))
                {
                    newCsv.Add(row);
                }
            }

            return(newCsv);
        }