ICollection<ElementId> GetUnusedTextNoteTypes(
Document doc)
{
FilteredElementCollector collector
= new FilteredElementCollector( doc );
ICollection<ElementId> textNoteTypes
= collector.OfClass( typeof( TextNoteType ) )
.ToElementIds()
.ToList();
FilteredElementCollector textNotes
= new FilteredElementCollector( doc )
.OfClass( typeof( TextNote ) );
foreach( TextNote textNote in textNotes )
{
bool removed = textNoteTypes.Remove(
textNote.TextNoteType.Id );
}
return textNoteTypes;
}