Skip to content

Use Target Type new only when apparent #2958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

stefannikolei
Copy link
Contributor

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

@stefannikolei stefannikolei marked this pull request as ready for review June 28, 2025 18:50
@Copilot Copilot AI review requested due to automatic review settings June 28, 2025 18:50
Copy link

@Copilot 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 enforces explicit type constructors instead of target-typed new(...) in places where the target type is not immediately obvious. It updates calls across image processing extensions, primitive types, pixel formats, metadata profiles, and memory management APIs to use new Type(...) or new Type[] syntax explicitly.

  • Replaced ambiguous new(...) expressions with new Rectangle(...), new Size(...), new Vector2(...), new Vector4(...), etc.
  • Updated collection and metadata initializers to use explicit type names.
  • Refactored image and memory-related constructors to avoid relying on target-typed new.

Reviewed Changes

Copilot reviewed 300 out of 703 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ResizeExtensions.cs Changed new(…) to new Rectangle(…) in resize overloads.
Primitives/SizeF.cs, Size.cs Replaced new(…) with new Vector2/SizeF(…) in transforms.
Primitives/RectangleF.cs, Rectangle.cs Made rectangle constructors explicit.
PixelFormats/** Updated pixel constructors (Vector4, Vector2, Rgba32).
Memory/UnmanagedMemoryManager{T}.cs Made Span<T> and MemoryHandle constructions explicit.
Metadata/Profiles/ICC/DataReader/IccDataReader.TagData Changed tag entry new(…) to new Icc…(…).
Image{TPixel}.cs, ImageFrame{TPixel}.cs Expanded new() calls for ImageMetadata and ImageFrameMetadata.

@stefannikolei
Copy link
Contributor Author

@JimBobSquarePants i also opened a PR in the SharedInfrastructure project.

@stefannikolei
Copy link
Contributor Author

@JimBobSquarePants Updated the shared-infra submodule

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.

1 participant