Skip to content

Latest commit

 

History

History
9 lines (6 loc) · 793 Bytes

how-it-works.md

File metadata and controls

9 lines (6 loc) · 793 Bytes

The Connected Properties library is just a thin wrapper around ConditionalWeakTable<TKey, TValue>.

Each "connected property scope" is actually an instance of ConditionalWeakTable.

The wrapper provides the following advantages over using ConditionalWeakTable directly:

  • You may attach value types to carrier objects (ConditionalWeakTable values must be reference types).
  • Carrier objects are checked at runtime to prevent accidentally using an improper carrier object.
  • The API for accessing property values is more complete (e.g., Set) and does not have vexing exceptions (ConditionalWeakTable has a vexing exception for its Add method).