Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
JelteDeJong
in reply to: j.pavlicek

  • .Cast(of ComponentOccurrence)
    • Converts the ComponentOccurrences object to the object  IEnumerable(of ComponentOccurrence). That allows us to use the LINQ functions of vb.net
  • .Select(Function(occ) occ.ReferencedDocumentDescriptor.ReferencedDocument)
    • This will create an IEnumerable(of Document). The documents are selected from the occurrences.
  • Distinct()
    • Will remove all duplicates from the list. You will have duplicates if you use 1 document for multiple occurrences
  • .ToList()
    • This will convert the object IEnumerable(of Document) to a List(of Document). Strictly this is not needed as you can loop over an IEnumerable(of Document) but because LINQ is lazy it will only do all the above when you create a list. (or start using the IEnumerable like in a for/each loop). I experienced some extra performances when I used a List instead of the IEnumerable

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com