object[] a1 = new string[3]; // Legal object[] a2 = new int[3]; // Error
why is that? why int cant implicitly be converted to an object?
isnt int type of object?
object[] a1 = new string[3]; // Legal object[] a2 = new int[3]; // Error
why is that? why int cant implicitly be converted to an object?
isnt int type of object?
Array covariance specifically does not extend to arrays of value-types. For
example, no conversion exists that permits an int[] to be treated as an
object[]."
When you pass an int[], it gets loaded into an object[] of length 1 and
passed to your method.
alright , now it is clear
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.