Skip to content

use _value instead of ToString in SqlConnectionEncryptOption#4013

Open
SimonCropp wants to merge 1 commit intodotnet:mainfrom
SimonCropp:use-_value-instead-of-ToString-in-SqlConnectionEncryptOption
Open

use _value instead of ToString in SqlConnectionEncryptOption#4013
SimonCropp wants to merge 1 commit intodotnet:mainfrom
SimonCropp:use-_value-instead-of-ToString-in-SqlConnectionEncryptOption

Conversation

@SimonCropp
Copy link
Contributor

No description provided.

@SimonCropp SimonCropp requested a review from a team as a code owner March 6, 2026 13:25
Copilot AI review requested due to automatic review settings March 6, 2026 13:25
@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 is a minor performance/quality improvement to SqlConnectionEncryptOption. The Equals and GetHashCode overrides previously called ToString() and then compared/hashed the returned string. Since ToString() simply returns the private _value field, the PR replaces those indirect calls with direct access to _value, eliminating two unnecessary virtual method dispatches.

Changes:

  • Equals(object) now compares _value directly instead of going through ToString().
  • GetHashCode() now hashes _value directly instead of going through ToString().

@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