Skip to content

Conversation

@Tyrrrz
Copy link
Owner

@Tyrrrz Tyrrrz commented Nov 16, 2025

No description provided.

Copilot AI review requested due to automatic review settings November 16, 2025 16:38
@Tyrrrz Tyrrrz added the enhancement New feature or request label Nov 16, 2025
Copilot finished reviewing on behalf of Tyrrrz November 16, 2025 16:41
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 adds polyfills for Math.Clamp(...) to enable this API on older .NET framework versions.

  • Adds generic Math.Clamp<T> polyfill for frameworks before .NET Core 2.0
  • Adds Math.Clamp for IntPtr (nint) for frameworks before .NET 6.0
  • Includes test coverage for both polyfill implementations

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
PolyShim/NetCore20/Math.cs Implements generic Math.Clamp<T> polyfill using IComparable<T> for frameworks lacking .NET Core 2.0 APIs
PolyShim/Net60/Math.cs Implements Math.Clamp for IntPtr/nint type for frameworks lacking .NET 6.0 APIs
PolyShim.Tests/NetCore20/MathTests.cs Adds tests for generic clamp implementation covering integer and double types
PolyShim.Tests/Net60/MathTests.cs Adds tests for IntPtr clamp implementation covering basic clamping scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants