-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Remove redundant nullable operator #27023
Conversation
Remove redundant nullable operator for reference type. String is a reference type and always nullable,
Hi @ArtyProf, I'm not so sure that this change is accurate. The way you define your variables provide hints to the compiler as to your intent and expectation. For example, within a nullable context:
This will change the behavior of how C# reasons about your code. Tagging @BillWagner here - is my understanding of this correct? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see where there's confusion from the existing sample. I suggested a different update to the code sample. What do you think of this instead @ArtyProf ?
Co-authored-by: Bill Wagner <wiwagn@microsoft.com>
@BillWagner Agree with you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
closing and reopening for a fresh build. |
@BillWagner, @IEvangelist |
* Update cs5001.md (#27080) * Update cs5001.md * Update docs/csharp/misc/cs5001.md Co-authored-by: David Pine <david.pine@microsoft.com> * Remove redundant nullable operator (#27023) * Remove redundant nullable operator Remove redundant nullable operator for reference type. String is a reference type and always nullable, * Make undesired error more clear Co-authored-by: Bill Wagner <wiwagn@microsoft.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com> * update version * fix typo Co-authored-by: Machiel visser <16868513+machielvisser@users.noreply.github.com> Co-authored-by: David Pine <david.pine@microsoft.com> Co-authored-by: Artur Khutak <rd.artyrchik@gmail.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com>
* Update cs5001.md (#27080) * Update cs5001.md * Update docs/csharp/misc/cs5001.md Co-authored-by: David Pine <david.pine@microsoft.com> * Remove redundant nullable operator (#27023) * Remove redundant nullable operator Remove redundant nullable operator for reference type. String is a reference type and always nullable, * Make undesired error more clear Co-authored-by: Bill Wagner <wiwagn@microsoft.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com> * VS 2022 'preview' removed (#27070) * Fixed Typo (#27072) changed short description to shortDescription in the comments to avoid confusion. * Update package index with latest published versions (#27083) * Update ExampleAsyncDisposable.cs (#27074) * Details overloading `==` and `!=` operators on the `ValueObject` type (#27040) * Add details about overloading == and != operators * Apply suggestions from code review Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> * Fix text element count not starting at 1 (#27010) When the code sample `InsertNewlinesEveryTenTextElements` is run, the first newline is 11 characters long when it is meant to be 10. This commit fixes that by making the `textElementCount` start at 1. * Update code analysis props for .NET 6 (#26880) * Update package index with latest published versions (#27095) * Add link to Fedora .NET 6 tracking bug (#27091) * Update linux-fedora.md * Update linux-fedora.md * Retitle Fact 1 (#27102) Facts cannot be stated in an imperative form. Otherwise, I would call it a "tip". * Add the HTTP keyword to the expected list of available slug completions (#27104) * Address concerns about inconsistent code style and formatting (#27089) * Code style * Update usings.cs * Code block fix (#27103) * Update package index with latest published versions (#27105) * Fix NETSDK error number (#27106) * Add more info to recommended actions (#27093) * Add note about .NET Framework (#27107) * Update package index with latest published versions (#27108) * fix build suggestions (#27109) * Add note about FTP (#27094) * Add with-expressions to anonymous types (#27111) * Add with-expressions to anonymous types Fixes #26770 With-expressions can be used with anonymous types. * code review * Bump Humanizer (#27124) Bumps [Humanizer](https://github.com/Humanizr/Humanizer) from 2.11.10 to 2.13.14. - [Release notes](https://github.com/Humanizr/Humanizer/releases) - [Changelog](https://github.com/Humanizr/Humanizer/blob/main/release_notes.md) - [Commits](Humanizr/Humanizer@v2.11.10...v2.13.14) --- updated-dependencies: - dependency-name: Humanizer dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix Dispose(bool) method overload in ConjunctiveDisposable pattern (#27118) * Update ExampleAsyncDisposable.cs * Update ExampleConjunctiveDisposable.cs * Add documentation for CA2255 (new in .NET 6) (#27096) * Add documentation for CA2255 (new in .NET 6) * Address pr feedback * Remove backticks from page metadata (#27114) * Update package index with latest published versions (#27115) * acrolinx (#27117) * update front matter for .net 6 Co-authored-by: Machiel visser <16868513+machielvisser@users.noreply.github.com> Co-authored-by: David Pine <david.pine@microsoft.com> Co-authored-by: Artur Khutak <rd.artyrchik@gmail.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com> Co-authored-by: Jakub Kozera <kozerakuba@gmail.com> Co-authored-by: Azhar <17266828+mohamed-azhar@users.noreply.github.com> Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Co-authored-by: wuyuansushen <43259764+wuyuansushen@users.noreply.github.com> Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> Co-authored-by: Leo Spratt <enchant97@users.noreply.github.com> Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com> Co-authored-by: Radosław Rowicki <35342116+radrow@users.noreply.github.com> Co-authored-by: Ken Dale <ken@kendaleiv.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
* Update cs5001.md (#27080) * Update cs5001.md * Update docs/csharp/misc/cs5001.md Co-authored-by: David Pine <david.pine@microsoft.com> * Remove redundant nullable operator (#27023) * Remove redundant nullable operator Remove redundant nullable operator for reference type. String is a reference type and always nullable, * Make undesired error more clear Co-authored-by: Bill Wagner <wiwagn@microsoft.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com> * update version * fix typo Co-authored-by: Machiel visser <16868513+machielvisser@users.noreply.github.com> Co-authored-by: David Pine <david.pine@microsoft.com> Co-authored-by: Artur Khutak <rd.artyrchik@gmail.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com>
* Blazor ebook frontmatter (#27086) * Update cs5001.md (#27080) * Update cs5001.md * Update docs/csharp/misc/cs5001.md Co-authored-by: David Pine <david.pine@microsoft.com> * Remove redundant nullable operator (#27023) * Remove redundant nullable operator Remove redundant nullable operator for reference type. String is a reference type and always nullable, * Make undesired error more clear Co-authored-by: Bill Wagner <wiwagn@microsoft.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com> * update version * fix typo Co-authored-by: Machiel visser <16868513+machielvisser@users.noreply.github.com> Co-authored-by: David Pine <david.pine@microsoft.com> Co-authored-by: Artur Khutak <rd.artyrchik@gmail.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com> * Blazor Hot Reload (#27166) * Blazor Hot Reload section * fixing hot to Hot * Apply suggestions from code review Co-authored-by: David Pine <david.pine@microsoft.com> Co-authored-by: David Pine <david.pine@microsoft.com> * update vs images (#27375) * Update to .NET 6 / VS 2022 (#27379) * Pre-commit hook, applied automatic markdownlint CLI fixes Co-authored-by: Steve Smith <steve@kentsmiths.com> Co-authored-by: Machiel visser <16868513+machielvisser@users.noreply.github.com> Co-authored-by: Artur Khutak <rd.artyrchik@gmail.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com>
* Blazor ebook frontmatter (#27086) * Update cs5001.md (#27080) * Update cs5001.md * Update docs/csharp/misc/cs5001.md Co-authored-by: David Pine <david.pine@microsoft.com> * Remove redundant nullable operator (#27023) * Remove redundant nullable operator Remove redundant nullable operator for reference type. String is a reference type and always nullable, * Make undesired error more clear Co-authored-by: Bill Wagner <wiwagn@microsoft.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com> * update version * fix typo Co-authored-by: Machiel visser <16868513+machielvisser@users.noreply.github.com> Co-authored-by: David Pine <david.pine@microsoft.com> Co-authored-by: Artur Khutak <rd.artyrchik@gmail.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com> * VS 2022 'preview' removed (#27070) * Fixed Typo (#27072) changed short description to shortDescription in the comments to avoid confusion. * Update package index with latest published versions (#27083) * Update ExampleAsyncDisposable.cs (#27074) * Details overloading `==` and `!=` operators on the `ValueObject` type (#27040) * Add details about overloading == and != operators * Apply suggestions from code review Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> * Fix text element count not starting at 1 (#27010) When the code sample `InsertNewlinesEveryTenTextElements` is run, the first newline is 11 characters long when it is meant to be 10. This commit fixes that by making the `textElementCount` start at 1. * Update code analysis props for .NET 6 (#26880) * Update package index with latest published versions (#27095) * Add link to Fedora .NET 6 tracking bug (#27091) * Update linux-fedora.md * Update linux-fedora.md * Retitle Fact 1 (#27102) Facts cannot be stated in an imperative form. Otherwise, I would call it a "tip". * Add the HTTP keyword to the expected list of available slug completions (#27104) * Address concerns about inconsistent code style and formatting (#27089) * Code style * Update usings.cs * Code block fix (#27103) * Update package index with latest published versions (#27105) * Fix NETSDK error number (#27106) * Add more info to recommended actions (#27093) * Add note about .NET Framework (#27107) * Update package index with latest published versions (#27108) * fix build suggestions (#27109) * Add note about FTP (#27094) * Add with-expressions to anonymous types (#27111) * Add with-expressions to anonymous types Fixes #26770 With-expressions can be used with anonymous types. * code review * Bump Humanizer (#27124) Bumps [Humanizer](https://github.com/Humanizr/Humanizer) from 2.11.10 to 2.13.14. - [Release notes](https://github.com/Humanizr/Humanizer/releases) - [Changelog](https://github.com/Humanizr/Humanizer/blob/main/release_notes.md) - [Commits](Humanizr/Humanizer@v2.11.10...v2.13.14) --- updated-dependencies: - dependency-name: Humanizer dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix Dispose(bool) method overload in ConjunctiveDisposable pattern (#27118) * Update ExampleAsyncDisposable.cs * Update ExampleConjunctiveDisposable.cs * Add documentation for CA2255 (new in .NET 6) (#27096) * Add documentation for CA2255 (new in .NET 6) * Address pr feedback * Remove backticks from page metadata (#27114) * Update package index with latest published versions (#27115) * acrolinx (#27117) * Restore the Azure for .NET devs tile (#27128) * Update rabbitmq-event-bus-development-test-environment.md (#27134) Fixes #27130 * Fix typo (#27141) * Acrolinx 11/17 (#27131) * acrolinx * fix link * Blazor Hot Reload (#27166) * Blazor Hot Reload section * fixing hot to Hot * Apply suggestions from code review Co-authored-by: David Pine <david.pine@microsoft.com> Co-authored-by: David Pine <david.pine@microsoft.com> * update vs images (#27375) * Update to .NET 6 / VS 2022 * Update to .NET 6 / VS 2022 (#27379) * Update startup details * update with new features * updating startup references * update ms.date and another startup reference * Update ms.date * update references to startup files and older versions of .NET * Apply suggestions from code review Co-authored-by: David Pine <david.pine@microsoft.com> * Update docs/architecture/blazor-for-web-forms-developers/project-structure.md Co-authored-by: David Pine <david.pine@microsoft.com> * fixing links Co-authored-by: Machiel visser <16868513+machielvisser@users.noreply.github.com> Co-authored-by: David Pine <david.pine@microsoft.com> Co-authored-by: Artur Khutak <rd.artyrchik@gmail.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com> Co-authored-by: Jakub Kozera <kozerakuba@gmail.com> Co-authored-by: Azhar <17266828+mohamed-azhar@users.noreply.github.com> Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Co-authored-by: wuyuansushen <43259764+wuyuansushen@users.noreply.github.com> Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> Co-authored-by: Leo Spratt <enchant97@users.noreply.github.com> Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com> Co-authored-by: Radosław Rowicki <35342116+radrow@users.noreply.github.com> Co-authored-by: Ken Dale <ken@kendaleiv.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com> Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com>
* Update cs5001.md (dotnet#27080) * Update cs5001.md * Update docs/csharp/misc/cs5001.md Co-authored-by: David Pine <david.pine@microsoft.com> * Remove redundant nullable operator (dotnet#27023) * Remove redundant nullable operator Remove redundant nullable operator for reference type. String is a reference type and always nullable, * Make undesired error more clear Co-authored-by: Bill Wagner <wiwagn@microsoft.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com> * update version * fix typo Co-authored-by: Machiel visser <16868513+machielvisser@users.noreply.github.com> Co-authored-by: David Pine <david.pine@microsoft.com> Co-authored-by: Artur Khutak <rd.artyrchik@gmail.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com>
* Update Porting eBook Cover Image (#27325) * update front matter, preview notices, and referenes to .NET 5 * update cover * Update startup details * update with new features * updating startup references * Blazor ebook frontmatter (#27086) * Update cs5001.md (#27080) * Update cs5001.md * Update docs/csharp/misc/cs5001.md Co-authored-by: David Pine <david.pine@microsoft.com> * Remove redundant nullable operator (#27023) * Remove redundant nullable operator Remove redundant nullable operator for reference type. String is a reference type and always nullable, * Make undesired error more clear Co-authored-by: Bill Wagner <wiwagn@microsoft.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com> * update version * fix typo Co-authored-by: Machiel visser <16868513+machielvisser@users.noreply.github.com> Co-authored-by: David Pine <david.pine@microsoft.com> Co-authored-by: Artur Khutak <rd.artyrchik@gmail.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com> * Blazor Hot Reload (#27166) * Blazor Hot Reload section * fixing hot to Hot * Apply suggestions from code review Co-authored-by: David Pine <david.pine@microsoft.com> Co-authored-by: David Pine <david.pine@microsoft.com> * update ms.date and another startup reference * Update ms.date * update references to startup files and older versions of .NET * fixing links * Apply suggestions from code review Co-authored-by: David Pine <david.pine@microsoft.com> * Update docs/architecture/blazor-for-web-forms-developers/project-structure.md Co-authored-by: David Pine <david.pine@microsoft.com> * Update docs/architecture/porting-existing-aspnet-apps/authentication-differences.md Co-authored-by: Steve Smith <steve@kentsmiths.com> Co-authored-by: Machiel visser <16868513+machielvisser@users.noreply.github.com> Co-authored-by: Artur Khutak <rd.artyrchik@gmail.com> Co-authored-by: Bill Wagner <wiwagn@microsoft.com>
Removed redundant nullable operator for reference type. String is a reference type and always nullable,
Summary
Removed redundant nullable operator for reference type. String is a reference type and always nullable,
Fixes #27021