C#
C#

help

Root Question Message

thinker227
thinker22710/5/2022
Differing covariant arrays [Answered]

Why does this work
var xs = new string[] {};
object[] ys = xs;
but this doesn't?
var xs = new int[] {};
object[] ys = xs;

also idk what to name this post
Orannis
Orannis10/5/2022
Variance only works for reference conversions
Orannis
Orannis10/5/2022
int->object is a boxing conversion
thinker227
thinker22710/5/2022
That makes sense
thinker227
thinker22710/5/2022
I think this is also the same for variance in interfaces, right?
Orannis
Orannis10/5/2022
variance period
thinker227
thinker22710/5/2022
right
ContactFrequently Asked QuestionsJoin The DiscordBugs & Feature RequestsTerms & Privacy