Skip to content

Conversation

@Rageking8
Copy link
Contributor

@Rageking8 Rageking8 commented Nov 14, 2023

Summary

The previous wording implied that System.Object cannot be marked const, which is not true. They are allowed but can only be initialized with a null value.


Internal previews

📄 File 🔗 Preview link
docs/csharp/programming-guide/classes-and-structs/constants.md Constants (C# Programming Guide)

@dotnet-bot dotnet-bot added this to the November 2023 milestone Nov 14, 2023
@ghost ghost added the community-contribution Indicates PR is created by someone from the .NET community. label Nov 14, 2023
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Rageking8

I made one suggestion to limit the initialization restriction to const declarations. See what you think. Once we resolve this, it's ready to merge.

Co-authored-by: Bill Wagner <wiwagn@microsoft.com>
@BillWagner BillWagner enabled auto-merge (squash) November 14, 2023 15:29
@BillWagner BillWagner merged commit b0508a2 into dotnet:main Nov 14, 2023
@Rageking8 Rageking8 deleted the tweak-constants-programming-guide branch November 16, 2023 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates PR is created by someone from the .NET community. dotnet-csharp/svc fundamentals/subsvc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants