-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default value behaviour – nullable value types
point in list is inconsistent with other places and incorrect
#27181
Comments
nullable value types
point in list is inconsistent with other placesnullable value types
point in list is inconsistent with other places and incorrect
Thanks for noting this @Uzivatel919 I want to think about how to present this in a way that is both consistent and usable. There are a few related behaviors with respect to arrays and types (especially nullable types). I think the updates are somewhere along these lines:
The reason for this behavior is to balance the performance needs of not calling a parameterless constructor for each element with having well defined behavior for freshly allocated arrays. |
Fixing this as part of the work on collection expressions. #36356 |
Edit and update the Arrays article. Remove older outdated samples, update style (both text and code), and fix two open issues: - Fix dotnet#27181 Clarify the default value for array elements. - Fix dotnet#29181 Clarify the row, column for a 2D array.
Edit and update the Arrays article. Remove older outdated samples, update style (both text and code), and fix two open issues: - Fix dotnet#27181 Clarify the default value for array elements. - Fix dotnet#29181 Clarify the row, column for a 2D array.
* Update TOC Move programming guide articles on arrays and collections into the language reference section. This set of content will be updated and edited, then collection expressions will be added. * Move array content Move all array content into the language reference. * Move all snippets Move snippets to the language reference location. * Update internal links Run cleanrepo to update redirected links with the new target, and replace absolute links with relative links. * Edit pass on collections article Fix open issues on the collection articles, and perform an edit pass to update. Simplify examples and remove outdated examples. Update text. Instead of listing all collections, refer to articles in the .NET fundamentals and API reference where all collections are listed. * Edit pass on Arrays article Edit and update the Arrays article. Remove older outdated samples, update style (both text and code), and fix two open issues: - Fix #27181 Clarify the default value for array elements. - Fix #29181 Clarify the row, column for a 2D array. * rough draft of collection expressions. * grammar check and build issues Do a grammar check on the new article, fix build warnings, and add links. * modify title The language reference and spec titles were duplicated * Apply suggestions from code review Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> * respond to feedback. --------- Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
From Types|Default constructors
From Default values of C# types (C# reference)
FPOV is it correct to state that value hidden in
Nullable<T>
isdefault
(notnull
) rather than presenting behavior characteristics ofValue
property. That since initialization/default is discussed which by nature relates to fields.On the other hand
private readonly bool hasValue
stays in darkness of black box for consumer so there is little antinomy in such approach.Maybe just right would be to state 0-bit pattern obedience along with behavior of
Value
property. Many otherstructs
are black boxes that return via properties so I guess there is no need to tell explicitly that after default initialization anybool
property returnsfalse
.Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Associated WorkItem - 148959
The text was updated successfully, but these errors were encountered: