Skip to content

Conversation

@stephentoub
Copy link
Member

No description provided.

@github-actions github-actions bot changed the title Use Random.GetString in hosting IdGenerator .NET: Use Random.GetString in hosting IdGenerator Nov 24, 2025
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 optimizes ID generation by using the built-in Random.GetString() method for .NET 10+ instead of manually creating random strings with string.Create(). This simplifies the code and leverages framework optimizations for better performance.

  • Uses conditional compilation to call Random.GetString() when available
  • Maintains backward compatibility with older .NET versions using the existing string.Create() implementation
  • Preserves the deterministic random generation behavior when a seed is provided

@stephentoub stephentoub added this pull request to the merge queue Nov 25, 2025
Merged via the queue into microsoft:main with commit 7a4f687 Nov 25, 2025
21 checks passed
This was referenced Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants