Docs: What's "a compatible array type"?

Created on 9 Dec 2019  Â·  2Comments  Â·  Source: dotnet/docs

I think that'd be good if there's some explanation somewhere in C# docs.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Area - C# Guide Technology - C# Fundamentals P1 doc-bug

All 2 comments

Thanks for pointing this out @mrmowji

Updating the tour of C# section is on our list of upcoming tasks. We'll address this as part of that work.

@mrmowji: To answer your question: C# allows unsafe array covariance in some cases. For example, a string[] reference may be stored in a variable of type object[] even though writing a non-string via the variable would crash. Also, the CLR allows references to int[] to be stored in a variable of type uint[], and similarly for other integral types.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LJ9999 picture LJ9999  Â·  3Comments

svick picture svick  Â·  3Comments

stanuku picture stanuku  Â·  3Comments

garfbradaz picture garfbradaz  Â·  3Comments

tswett picture tswett  Â·  3Comments