C
C#2d ago
zacoons

Convert Span<string> to Span<object>

Is this possible?
3 Replies
jcotton42
jcotton422d ago
Not safety. The ability to do this with arrays is considered a mistake nowadays.
string[] ss = …;
object[] os = ss;
os[0] = 2; // explodes at runtime
string[] ss = …;
object[] os = ss;
os[0] = 2; // explodes at runtime
zacoons
zacoonsOP2d ago
that's very true I've never thought about doing that
Petris
Petris2d ago
yeah if possible use that instead

Did you find this page helpful?