Closed testfirstcoder closed 3 months ago
Is this really the same? This is in the UI, does it even matter?
Is this really the same?
{ var dateTimeTypesInitial = Enum .GetNames(typeof(TypeScriptDateTimeType)) .Select(t => (TypeScriptDateTimeType)Enum.Parse(typeof(TypeScriptDateTimeType), t)) .ToArray();
var dateTimeTypesRefactored = (TypeScriptDateTimeType[])Enum.GetValues(typeof(TypeScriptDateTimeType));
Debug.Assert(dateTimeTypesInitial.GetType().Equals(dateTimeTypesRefactored.GetType()));
Debug.Assert(dateTimeTypesInitial.SequenceEqual(dateTimeTypesRefactored));
}
> does it even matter?
Not sure if but it's concise and more readable.
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