示例#1
0
        public void Remove(Volunteers volunteersToRemove)
        {
            var identityLookup = new Dictionary <int, bool>();

            foreach (Volunteer volunteer in volunteersToRemove)
            {
                identityLookup[volunteer.Identity] = true;
            }

            int index = 0;

            while (index < Count)
            {
                if (identityLookup.ContainsKey(this[index].Identity))
                {
                    // This volunteer should be removed from the list.

                    RemoveAt(index);
                }
                else
                {
                    // If nothing was removed, increment index.

                    index++;
                }
            }
        }
示例#2
0
        public static Volunteers FromSingle(Volunteer volunteer)
        {
            var volunteers = new Volunteers();

            volunteers.Add(volunteer);

            return(volunteers);
        }
示例#3
0
        public static Volunteers FromArray(BasicVolunteer[] basicArray)
        {
            var result = new Volunteers();

            result.Capacity = basicArray.Length * 11 / 10;
            foreach (BasicVolunteer basic in basicArray)
            {
                result.Add(Volunteer.FromBasic(basic));
            }

            return(result);
        }