drewnoakes / metadata-extractor-dotnet

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Other
915 stars 158 forks source link

Use primary constructors #381

Closed iamcarbon closed 5 months ago

iamcarbon commented 5 months ago

Updates the descriptors and directories to use primary constructors, and tidy up a few things.

iamcarbon commented 5 months ago

@drewnoakes Ready for review

drewnoakes commented 5 months ago

Left some comments.

There's a few unrelated changes in this commit/PR which makes it harder to discuss, especially given the number of files touched. I think this could have been a few separate PRs. For example, if we were to revert the params array change, it'd be hard to unpick.

iamcarbon commented 5 months ago

Let me know if the use of primary constructor pattern looks good to you, and I'll redo this PR to include only the primary constructor changes.

I had started exploring updating all the param accepting functions to include brackets for clarity-- and to prepare another possible refactoring, by creating a ReadOnlySpan overload. That would eliminate the array allocation on each call on .NET8.0+. I'll leave this, however, to another refactoring.

drewnoakes commented 5 months ago

I like the primary constructors in the cases you have here.

Did you see my comments? I made them from my phone, but they're showing in a browser as "pending". I'll try sending them through now.

EDIT That seems to have flushed them through.

iamcarbon commented 5 months ago

Closing this PR in favor of #384. I'll breakout the other changes into their own PRs.