|
|
|
|
|
by Dwedit
588 days ago
|
|
Is this the feature that would let you put extension properties on everything? The most obvious way to store backing fields for arbitrary objects is to have a global concurrent dictionary that stores weak keys, and a compiler-generated class to store the backing fields as the value. But then you have a performance problem of needing to do a lookup from a weak-concurrent-dictionary every time you access any extension backing field. The higher-performance alternative would be a second shadow variable in code that uses the extension backing fields. Do your dictionary lookup, then cache the backing-fields-object so you don't need to redo lookups for it. But that would be function-local. If the extension property doesn't need a new backing field, it's trivial, you're just making a new getter and setter function pair. |
|