ActivEarth.Groups.GroupsSearch.ListUnion_NoRepeats C# (CSharp) Метод

ListUnion_NoRepeats() защищенный Метод

Returns the Union of the two List of Groups, with no repeating Groups. Each search term is separately queried and this method combines those lists.
protected ListUnion_NoRepeats ( List list1, List list2 ) : List
list1 List The list of Groups for the first search term
list2 List The list of Groups for the second search term
Результат List
        protected List<Group> ListUnion_NoRepeats(List<Group> list1, List<Group> list2)
        {
            foreach (Group group in list2)
            {
                Boolean found = false;

                foreach (Group group2 in list1)
                {
                    if (group.ID == group2.ID)
                    {
                        found = true;
                    }
                }
                if (!found)
                {
                    list1.Add(group);
                }
            }

            return list1;
        }