Esempio n. 1
0
 public void Filter(string word)
 {
     if (!_filter.Contains(word))
     {
         Console.WriteLine(word);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Returns the intersection of this set and that set.
        /// </summary>
        /// <param name="that">that the other set</param>
        /// <returns>the intersection of this set and that set</returns>
        /// <exception cref="NullReferenceException">if <tt>that</tt> is <tt>null</tt></exception>
        public SET <TKey> Intersects(SET <TKey> that)
        {
            if (that == null)
            {
                throw new NullReferenceException("called intersects() with a null argument");
            }
            var c = new SET <TKey>();

            if (Size() < that.Size())
            {
                foreach (var x in this)
                {
                    if (that.Contains(x))
                    {
                        c.Add(x);
                    }
                }
            }
            else
            {
                foreach (var x in that)
                {
                    if (this.Contains(x))
                    {
                        c.Add(x);
                    }
                }
            }
            return(c);
        }