Пример #1
0
        public IEnumerable <T> GetCommonElements(Hierarchy <T> other)
        {
            var commonElements = new List <T>();

            foreach (var item in this.nodesByValue.Keys)
            {
                if (other.Contains(item))
                {
                    commonElements.Add(item);
                }
            }
            return(commonElements);
        }
        public IEnumerable <T> GetCommonElements(Hierarchy <T> other)
        {
            List <T> collection = new List <T>();

            foreach (var kvp in this._nodesByValue)
            {
                if (other.Contains(kvp.Key))
                {
                    collection.Add(kvp.Key);
                }
            }

            return(collection);
        }
Пример #3
0
        public IEnumerable <T> GetCommonElements(Hierarchy <T> other)
        {
            List <T> commonElements = new List <T>();

            foreach (var key in this.hierarchy.Keys)
            {
                if (other.Contains(key))
                {
                    commonElements.Add(key);
                }
            }

            return(commonElements);
        }
Пример #4
0
        public IEnumerable <T> GetCommonElements(Hierarchy <T> other)
        {
            List <T> collection = new List <T>();

            foreach (var kvp in this.nodesByValue)
            {
                if (other.Contains(kvp.Key))
                {
                    collection.Add(kvp.Key);
                }
            }
            return(collection);

            //var result = new HashSet<T>(this.nodesByValue.Keys);
            //result
            //    .IntersectWith(new HashSet<T>(this.nodesByValue.Keys));
            //return result;
        }