views:

187

answers:

3

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.

A: 

Boxing and Unboxing?

Neil N
No, it's a term that has to do with casting arrays.
Max Schmeling
I honsetly cant think of any term that would pertain to arrays specifically. +1 for interesting question.
Neil N
+3  A: 

Co-variance and contra-variance. Probably.

Steve Dunn
@Steve: I think you're right. More information about Covariance and Contravariance in C# here: http://blogs.msdn.com/ericlippert/archive/2007/10/16/covariance-and-contravariance-in-c-part-one.aspx
Grant Wagner
I included the link because Part One talks about Covariance and Contravariance in more general terms, in case people want some background on what they are.
Grant Wagner
That's what I was trying to think of. THanks.
Max Schmeling
I guess from reading that msdn blog post it doesn't apply to arrays specifically. But it is what I was thinking of.
Max Schmeling
@Max: Part Two of Eric's series deals specifically with Array Covariance (but not Contravariance) (in C#): http://blogs.msdn.com/ericlippert/archive/2007/10/17/covariance-and-contravariance-in-c-part-two-array-covariance.aspx
Grant Wagner
Hey this answer is simply WRONG. These may be what you had in mind but these ARE NOT names for array upcasting/downcasting!
zvolkov
+3  A: 

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.

zvolkov
You know, that would have been a whole heck of a lot easier to remember than Co-variance and Contra-variance. Maybe we should change the terminology? lol
Max Schmeling