-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
🚧Refactor GlyphMetrics to readonly record #803
Comments
Starting work on this. |
@map-b I have assigned the issue to you. Please note, I added a note in the description above stating to make sure to keep the prop definitions in the struct and to not use primary constructors. Cheers!! |
Of course! I didn't see it helpful in this case yesterday. I don't know if keeping the definition of the constructor although It isn't used? |
Thanks. I appreciate that!! As of right now, it looks like I will be avoiding primary constructors when it comes to dependency injection, and then data holding types will probably move to primary constructors. But I need to think about what problems might arise, performance, I am super excited to move to dotnet 8 though!! If you are interested in following (watching) issue #810 as I keep adding to it and doing research, you are welcome to. If you are interested in knowing the state of the entire organization and all of it's projects, you can view the org project here |
* Start work for issue #803 * Refactor: GlyphMetrics struct to readonly record struct. * Fix "GameHelpers-> ApplySize" return value override actual values. * Refactor: Fix tests using "with" for "readonly record struct" initializations. * Clean up * Only use the "with" keyword when it is needed (avoid unnecessary copy). * Remove old struct custom tests.
Complete The Item Below
Description
Refactor the
GlyphMetrics
struct to areadonly record struct
. This will provide performance benefits as well as make the struct data immutable. When refactoring the code, use thewith
keyword.This struct holds data required for creating font atlas textures when loading fonts, which dictates how the text will be rendered with a particular font.
Also, refactor the properties to
public init
properties. This will provide the ability to set the initial values of the properties as well as keep the structure immutable.Make sure that the XML docs for the properties have been updated.
Example:
Things To Consider:
IEquatable<T>
is not required forrecord
's. This is because theEquals()
method that the interface provides is built into records.Equals()
override bool Equals()
andGetHashCode()
are built-into recordsDelete the
GlyphMetricsTests
file. Thestruct
is so simple combined with the removal of theEquals()
methods, that there is nothing to test anymore.Acceptance Criteria
GlyphMetrics
structure has been refactored to areadonly record struct
.struct
has been refactoredGlyphMetricsTests
file has been deleted.ToDo Items
Issue Dependencies
No response
Related Work
No response
Additional Information:
Change Type Labels
🐛bug
🧨breaking changes
✨new feature
♻️cicd
⚙️config
🏎️performance
🗒️documentation/code
📝documentation/product
Priority Type Labels
low priority
medium priority
high priority
Code of Conduct
The text was updated successfully, but these errors were encountered: