コード例 #1
0
 /// <summary>
 /// Fast test for the existence of any intersection between the current list and another
 /// </summary>
 public bool HasIntersection(InkList otherList)
 {
     foreach (var kv in this)
     {
         if (otherList.ContainsKey(kv.Key))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #2
0
        /// <summary>
        /// Returns a new list that is the intersection of the current list with another
        /// list that's passed in - i.e. a list of the items that are shared between the
        /// two other lists. Equivalent to calling (list1 ^ list2) in ink.
        /// </summary>
        public InkList Intersect(InkList otherList)
        {
            var intersection = new InkList();

            foreach (var kv in this)
            {
                if (otherList.ContainsKey(kv.Key))
                {
                    intersection.Add(kv.Key, kv.Value);
                }
            }
            return(intersection);
        }