Covariance of IChangeSet #681
Unanswered
benjamin-hejl
asked this question in
Q&A
Replies: 1 comment
-
Alas the implementation of dd breaks the rules of covariance due to the signature of the changeset. It was less deigned in and more of a necessity of achieving the functionality |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
A question related to design. In my project I am using pattern like this for concrete implementations of an abstraction which manages other abstract items (e.g. IDeviceManager & IDevice):
But this is not possible since
IChangeSet<T>
is not covariant (e.i.IChangeSet<out TObject, TKey>
). I understand why. To make this possible, there would have to be some kind ofIChange<out TObject, TKey>
interface. Using the interface would mean allocations were made whenever changes occur, which does not happen now, since a structChange<TObject,TKey>
is used instead.But when going through the code, I discovered, that within
Change<TObject>
for lists is a class. Is there some kind of reason for the different approach?Are there some benchmarks which prove the performance drop is too big to enable this, in my opinion, logical use case?
I know I can handle my problem using the
Cast
operator and some other workarounds.Beta Was this translation helpful? Give feedback.
All reactions