Skip to content

Refactored immutable structs into record types.#3

Merged
lextatic merged 1 commit intomainfrom
feature/csharp-record
Sep 8, 2025
Merged

Refactored immutable structs into record types.#3
lextatic merged 1 commit intomainfrom
feature/csharp-record

Conversation

@lextatic
Copy link
Contributor

@lextatic lextatic commented Sep 7, 2025

Refactored several immutable structs into record types, significantly reducing boilerplate code.

Applied minor optimizations while ensuring no changes to existing functionality.

Copilot AI review requested due to automatic review settings September 7, 2025 23:58
@lextatic lextatic added the changed Changes in existing functionality label Sep 7, 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 refactors several immutable struct types to use C# record syntax, significantly reducing boilerplate code while maintaining the same functionality. The changes focus on eliminating manual implementations of equality operators, hash code generation, and property definitions.

  • Converted 20+ struct types to record struct types with auto-implemented properties and equality
  • Added compatibility support for .NET Standard 2.1 through IsExternalInit class
  • Updated property access patterns to match the new positional parameter naming

Reviewed Changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Forge/Effects/Stacking/StackingData.cs Converted to record struct, removed manual equality/hash implementations
Forge/Effects/Periodic/PeriodicData.cs Converted to record struct, simplified to single-line declaration
Forge/Effects/Modifiers/Modifier.cs Converted to record struct, removed boilerplate code
Forge/Effects/ModifierEvaluatedData.cs Converted struct to record struct
Forge/Effects/Magnitudes/*.cs Multiple magnitude types converted to record structs
Forge/Effects/Duration/DurationData.cs Converted to record struct with updated property name
Forge/Effects/ActiveEffect.cs Updated property access to use new naming (AttributeOverride.Value)
Forge/Attributes/*.cs Converted attribute-related structs to records and optimized EntityAttribute
Forge/Compatibility/IsExternalInit.cs Added compatibility support for .NET Standard 2.1
Multiple test files Updated constructor calls to use new positional parameter names

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@lextatic lextatic changed the title Refactored code with record types. Refactor immutable structs into record types. Sep 8, 2025
@lextatic lextatic merged commit 37b442b into main Sep 8, 2025
1 check passed
@lextatic lextatic deleted the feature/csharp-record branch September 8, 2025 00:06
@lextatic lextatic changed the title Refactor immutable structs into record types. Refactored immutable structs into record types. Jan 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changed Changes in existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant