Skip to content

avoid tostring in SqlConnectionEncryptOptionConverter if we know value is a string#4012

Open
SimonCropp wants to merge 1 commit intodotnet:mainfrom
SimonCropp:avoid-tostring-in-SqlConnectionEncryptOptionConverter-if-we-know-value-is-a-string
Open

avoid tostring in SqlConnectionEncryptOptionConverter if we know value is a string#4012
SimonCropp wants to merge 1 commit intodotnet:mainfrom
SimonCropp:avoid-tostring-in-SqlConnectionEncryptOptionConverter-if-we-know-value-is-a-string

Conversation

@SimonCropp
Copy link
Contributor

No description provided.

@SimonCropp SimonCropp requested a review from a team as a code owner March 6, 2026 13:22
Copilot AI review requested due to automatic review settings March 6, 2026 13:22
@github-project-automation github-project-automation bot moved this to To triage in SqlClient Board Mar 6, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes a minor performance improvement in SqlConnectionEncryptOptionConverter.ConvertFrom by using C# pattern matching (value is string s) to avoid an unnecessary ToString() call on an object already known to be a string.

Changes:

  • Replace value is string type check + value.ToString() with value is string s pattern match to directly use the captured string variable.

@paulmedynski paulmedynski added the Code Health 💊 Issues/PRs that are targeted to source code quality improvements. label Mar 9, 2026
@paulmedynski paulmedynski added this to the 7.0.1 milestone Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code Health 💊 Issues/PRs that are targeted to source code quality improvements.

Projects

Status: To triage

Development

Successfully merging this pull request may close these issues.

3 participants