✅ HashSet property with List backing field
Posting here instead of in #database because it's not really related to db-specific stuff.
For reasons described vaguely here: https://github.com/npgsql/efcore.pg/issues/2301, I am looking to implement a
example class:
I want the underlying list field to be updated every time I modify the public property. Is there a way to accomplish this without any of the following?
For reasons described vaguely here: https://github.com/npgsql/efcore.pg/issues/2301, I am looking to implement a
HashSet<T> property with a List<T> backing field which updates appropriately as I add and remove objects from the publicly exposed HashSet<T>.example class:
I want the underlying list field to be updated every time I modify the public property. Is there a way to accomplish this without any of the following?
- never calling Add/Remove/etc methods and instead manually re-assigning the
BlacklistedHighlightUsersevery time - implementing my own wrapper class which overrides the Add/Remove/etc methods to somehow write to this underlying list
- giving up on doing this in the first place and using a public
List<T>and tossing on.ToHashSet().ToList()or.Distinct().ToList()everywhere I go