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++; } } }
public static Volunteers FromSingle(Volunteer volunteer) { var volunteers = new Volunteers(); volunteers.Add(volunteer); return(volunteers); }
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); }