Timeline for A hierarchical dictionary for dotnet
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 1, 2023 at 6:29 | comment | added | JohnLBevan | Thanks Morten; your suggestion of using interfaces for Employee makes sense. The Employee example was a demo of how I'd expect the generic hierarchical dictionary to be used, rather than the code I'm concerned about. The hierarchical dictionary is the bit I care about; as I've had to write similar logic for nagivating parent/child graphs a number of times / figured there should be something I could reuse. You're right though that I could put an interface on that then DI it into Employee, so I can swap it for an alternative for other scenarios (e.g. for one allowing circular dependencies). | |
Jun 29, 2023 at 11:59 | history | edited | Morten Bork | CC BY-SA 4.0 |
added 205 characters in body
|
Jun 29, 2023 at 11:51 | comment | added | Morten Bork | @JohnLBevan please review my changes, I tried to be clearer, think I might have failed :D | |
Jun 29, 2023 at 11:51 | history | edited | Morten Bork | CC BY-SA 4.0 |
Editted my answer to attempt to flesh out comment point.
|
Jun 29, 2023 at 11:38 | history | edited | Morten Bork | CC BY-SA 4.0 |
Editted my answer to attempt to flesh out comment point.
|
Jun 29, 2023 at 11:16 | comment | added | JohnLBevan | RE Linq/SelectMany, I agree there's other ways to code this logic... Is there a reason you'd suggest that method over the current implementation; i.e. what are the benefits to that approach over the current solution? | |
Jun 29, 2023 at 11:14 | comment | added | JohnLBevan |
I'm not sure I follow... When you say the "linked set" mechanism could just be put on the classes themselves do you mean coding the logic into the Employee class? For me, hierarchical data is a common pattern (e.g. nested security groups, file system directory structures, dependency graphs, family trees, etc). The logic for dealing with the hierarchical aspects is generally the same (you want to check whether there's a "direct line of inheritance" between two items, or you want to recurively list everything that's in that line from an item). i.e. a good candidate for encapsulation/generics
|
|
Jun 29, 2023 at 8:34 | history | answered | Morten Bork | CC BY-SA 4.0 |