Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC#covariance and contravarianceSingle-choice MCQ

Arrays in C# support covariance. What is the consequence of this code at runtime?

string[] strings = new string[2]; object[] objects = strings; // array covariance, compiles objects[0] = 42; // ?