Content deleted Content added
typo and redundant link |
Remove poorly worded and misguiding sentence about using `dynamic` in C# to circumvent static typing and work around variance |
||
Line 46:
Conversely, a {{java|Cat[]}} cannot be treated as an {{java|Animal[]}}. It should always be possible to put a {{java|Dog}} into an {{java|Animal[]}}. With covariant arrays this cannot be guaranteed to be safe, since the backing store might actually be an array of cats. So the covariant rule is also not safe—the array constructor should be ''invariant''. Note that this is only an issue for mutable arrays; the covariant rule is safe for immutable (read-only) arrays.
Likewise, the contravariant rule would be safe for write-only arrays.
=== Covariant arrays in Java and C# ===
|