12-21-2021
04:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
12-21-2021
04:29 AM
- .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.
Blog: hjalte.nl - github.com