y-iihoshi / ThScoreFileConverter

Score file converter for Touhou games
BSD 2-Clause "Simplified" License
25 stars 3 forks source link

Refactor Razor views #426

Open y-iihoshi opened 9 months ago

y-iihoshi commented 9 months ago

Currently, the Razor view that generates an HTML template of ThSFC depends strongly on string-keyed dictionaries based on enums. I would like to reduce reasonably the classes and instances, including such dictionaries, defined in TemplateGenerator.Models.* namespaces.

There are several points of concern for me:

y-iihoshi commented 9 months ago
  • Performance of enum and/or string related operations

I found that EqualityComparer<T>.Default for enums has already been implemented as follows in order to avoid boxing. So it is not necessary for me to implement a specialized EqualityComparer<T> used for enum-keyed dictionaries.

.NET 6.0: https://github.com/dotnet/runtime/blob/v6.0.0/src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/ComparerHelpers.cs#L147

.NET 8.0: https://github.com/dotnet/runtime/blob/v8.0.0/src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/ComparerHelpers.cs#L84