Skip to content

Refactor lazy initialization to use field backed property declarations#27413

Open
xtqqczze wants to merge 1 commit into
PowerShell:masterfrom
xtqqczze:simplified-field
Open

Refactor lazy initialization to use field backed property declarations#27413
xtqqczze wants to merge 1 commit into
PowerShell:masterfrom
xtqqczze:simplified-field

Conversation

@xtqqczze
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 11, 2026 19:23
@xtqqczze xtqqczze requested a review from a team as a code owner May 11, 2026 19:23
Copy link
Copy Markdown
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 refactors a set of lazily-initialized collections on InitialSessionState to use C# field-backed property declarations, reducing boilerplate while preserving the existing thread-safe initialization approach via Interlocked.CompareExchange.

Changes:

  • Replaced explicit private backing fields (_assemblies, _types, etc.) with field-backed properties using the field keyword.
  • Consolidated the previous if (x == null) CompareExchange(...) pattern into expression-bodied properties for multiple collections/dictionaries/sets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants