15 Replies
Uh
That’s because myData can’t be converted to a Dictionary<string, Data>
How would I fix it?
c++ we use templates. . .
And I was trying similar here.
variance issue
You can't convert a Dictionary<string, MyData> to a Dictionary<string, Data> even if MyData inherits from Data
If you were using an
IReadOnlyDictionary<string, Data>
instead it would work.Oh.
Is that interface covariant? The more you know
Okay, thank you for letting me. My syntax is correct then?
(I think so at least)
syntax is all fine
Thinker
REPL Result: Failure
Exception: CompilationErrorException
Compile: 533.352ms | Execution: 0.000ms | React with ❌ to remove this embed.
well nevermind then I guess
Why isn’t it though
Oh
It does seem extremely limited.
I mean, variance is variance :/
We fortunately don't have C++ templates 😄
c# is not my strong suit. C++ is a different matter and would quite simple.
Thank you both. I will keep looking at it and for another alternative.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.