BuildingCoder.CmdPurgeTextNoteTypes.GetUnusedTextNoteTypes C# (CSharp) Метод

GetUnusedTextNoteTypes() приватный Метод

Return all unused text note types by collecting all existing types in the document and removing the ones that are used afterwards.
private GetUnusedTextNoteTypes ( Document doc ) : ICollection
doc Document
Результат ICollection
        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;
        }