Skip to content

Commit

Permalink
cache date comparers
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Sep 21, 2024
1 parent bc2bff1 commit bdfe12a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Verify/Counter_DateTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

public partial class Counter
{
Dictionary<DateTime, (int intValue, string stringValue)> dateTimeCache = new(new DateTimeComparer());
static DateTimeComparer dateTimeComparer = new();
Dictionary<DateTime, (int intValue, string stringValue)> dateTimeCache = new(dateTimeComparer);
static Dictionary<DateTime, string> globalNamedDateTimes = [];

class DateTimeComparer : IEqualityComparer<DateTime>
Expand Down
3 changes: 2 additions & 1 deletion src/Verify/Counter_DateTimeOffset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

public partial class Counter
{
Dictionary<DateTimeOffset, (int intValue, string stringValue)> dateTimeOffsetCache = new(new DateTimeOffsetComparer());
static DateTimeOffsetComparer dateTimeOffsetComparer = new();
Dictionary<DateTimeOffset, (int intValue, string stringValue)> dateTimeOffsetCache = new(dateTimeOffsetComparer);
static Dictionary<DateTimeOffset, string> globalNamedDateTimeOffsets = [];

class DateTimeOffsetComparer :
Expand Down

0 comments on commit bdfe12a

Please sign in to comment.