SIL.FieldWorks.XWorks.InterestingTextList.ClearInvalidObjects C# (CSharp) Method

ClearInvalidObjects() private method

private ClearInvalidObjects ( List listToSearch, int offset, bool raiseChangeNotification ) : bool
listToSearch List
offset int
raiseChangeNotification bool
return bool
		private bool ClearInvalidObjects(List<IStText> listToSearch, int offset, bool raiseChangeNotification)
		{
			bool didRemoveAny = false;
			for (int i = listToSearch.Count - 1; i >= 0; i--)
			{
				if (!listToSearch[i].IsValidObject || listToSearch[i].OwnerOfClass(ScrDraftTags.kClassId) != null)
				{
					// Enhance JohnT: if several are removed, especially close together, we might want
					// to combine the change notifications. However I think this will be quite unusual.
					if (m_interestingTests != null)
						m_interestingTests.Remove(listToSearch[i]);
					listToSearch.RemoveAt(i);
					if (raiseChangeNotification)
						RaiseInterestingTextsChanged(i + offset, 0, 1);
					didRemoveAny = true;
				}
			}
			return didRemoveAny;
		}