Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's it called when you cast an array of objects to an array of strings?

There's a special name for it, but I can't remember what it is. There are two different terms, one for casting an array of a subclass to an array of its superclass, and the other way around.

like image 785
Max Schmeling Avatar asked Jul 31 '09 19:07

Max Schmeling


People also ask

How do you turn an array of objects into a string?

To convert a JavaScript array into a string, you can use the built-in Array method called toString . Keep in mind that the toString method can't be used on an array of objects because it will return [object Object] instead of the actual values.

Can you cast an object array to a string array in java?

As list. toArray() returns an Object[], it can be converted to String array by passing the String[] as parameter.

What is the name of function used to convert an array into a string?

The implode() function returns a string from the elements of an array. Note: The implode() function accept its parameters in either order.

How do you cast an object to a string array in C#?

object can be anything uint[], int16[], etc. string[] str = Array. ConvertAll<object, string>((object[])obj, Convert. ToString);


1 Answers

Array Upcasting and Array Downcasting.

EDIT: Covariance and Contravariance is ability to treat certain types as same or not the same depending on composition and inheritance semantics. This has nothing to do with casting arrays, which just happen to be one case where co-variance comes into play.

like image 156
Stop Putin Stop War Avatar answered Sep 29 '22 15:09

Stop Putin Stop War