public void RemoveDoc(String key) { Document doc; if (docs.TryRemove(key, out doc)) // Gets document of a id. { foreach (String term in doc.GetIndexedString()) // Splits the indexed string from the document. // Loops through all terms of the document. { lex.RemovePost(term, key); } } }