-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
use GetValues method instead of GetNames #4828
use GetValues method instead of GetNames #4828
Conversation
Is this really the same? |
Not sure if but it's concise and more readable. |
public TypeScriptDateTimeType[] DateTimeTypes { get; } = | ||
(TypeScriptDateTimeType[])Enum.GetValues(typeof(TypeScriptDateTimeType)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using the generic version Enum.GetValues() ?
public TypeScriptDateTimeType[] DateTimeTypes { get; } = | |
(TypeScriptDateTimeType[])Enum.GetValues(typeof(TypeScriptDateTimeType)); | |
public TypeScriptDateTimeType[] DateTimeTypes { get; } = Enum.GetValues<TypeScriptDateTimeType>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes very little difference to comment a merged PR, the work has been finished.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using the generic version Enum.GetValues() ?
According to the documentation the overloaded version of the generic method GetValues
is available from the version .NET Core 5.0.
The current framework version of the project NSwagStudio is .NET 4.6.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch, @testfirstcoder! 😅
Some performance improvement.
// * Summary *
BenchmarkDotNet v0.13.12, Windows 10 (10.0.19045.4170/22H2/2022Update)
Intel Core i7-10700 CPU 2.90GHz, 1 CPU, 16 logical and 8 physical cores
.NET SDK 8.0.202
[Host] : .NET 8.0.3 (8.0.324.11423), X64 RyuJIT AVX2
Job=.NET 8.0 Runtime=.NET 8.0