Replies: 1 comment 1 reply
-
Although this is not something I have been consistent with (and I am still not sure what is the best solution) I was duly following Microsoft's guidelines here (https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/guidelines-for-collections?redirectedfrom=MSDN#collection-prop[…]d-return-values):
It also says:
When I designed this interface, I was positively sure that users of these interfaces would need to do more with the returned list of children than just forward-only iteration, so I moved the responsibility of doing |
Beta Was this translation helpful? Give feedback.
-
Wondering if there is a purpose of the usage of this type over IEnumerable?
It's forcing a lot of code underneath to be tacking
.ToList()
on the end of some linq expression, which obviously is doing quite a bit, and if the list isn't needed, you've incurred quite a cost.The place I've stumbled on it is ChildDefinitions in ElementNode.
https://github.com/FirelyTeam/firely-net-common/blob/445e41f192697b711cf8c6551eae1c9b5c501dcb/src/Hl7.Fhir.ElementModel/Specification/IStructureDefinitionSummaryProvider.cs#L71
https://github.com/FirelyTeam/firely-net-common/blob/445e41f192697b711cf8c6551eae1c9b5c501dcb/src/Hl7.Fhir.Support.Poco/Introspection/ClassMapping.cs#L297
Beta Was this translation helpful? Give feedback.
All reactions