Skip to content

Conversation

@trivalik
Copy link

@trivalik trivalik commented Jun 13, 2025

fix typo at You cannot implicitly convert a double to an integer.

I checked in the line, that now this line is trigger the CS0266 error.


Internal previews

📄 File 🔗 Preview link
docs/csharp/language-reference/compiler-messages/cs0266.md Compiler Error CS0266

fix typo at `You cannot implicitly convert a double to an integer`
@trivalik trivalik requested review from a team and BillWagner as code owners June 13, 2025 04:43
@dotnetrepoman dotnetrepoman bot added this to the June 2025 milestone Jun 13, 2025
@BillWagner
Copy link
Member

Hi @trivalik

I looked at the change. The original sample was correct. It initializes a double, then tries to assign the double value to a second variable that is an int. That second assignment fails.

I'll close this without merging.

@BillWagner BillWagner closed this Jun 13, 2025
@trivalik
Copy link
Author

trivalik commented Jun 13, 2025

Hi @BillWagner,

double d = 3.2; is valid code. I do not understand how this could be correct, if no CS0266 error is thrown. The comment above this line states it.
Maybe is just the comment You cannot implicitly convert a double to an integer. misleading?

Change of the first two lines to?

            // You can implicitly convert an integer to a double.
            double d = 32;

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 lang-reference/subsvc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants