Runtime: TimeSpan more singleton options

Created on 8 Jul 2020  路  4Comments  路  Source: dotnet/runtime

I would like some more singleton options for TimeSpan: Hour, Day, Week

Maybe even Month (30 days) and Year (365), I understand these two would be up for debate.

area-System.Runtime untriaged

Most helpful comment

There's no point in any of these since TimeSpan is a struct, so there's no advantage to any "singleton" instances because you always copy them by-value. You can just as easily already use TimeSpan.FromHours(1), TimeSpan.FromDays(1), and TimeSpan.FromDays(7), respectively.

All 4 comments

This would be a request for dotnet/runtime

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

There's no point in any of these since TimeSpan is a struct, so there's no advantage to any "singleton" instances because you always copy them by-value. You can just as easily already use TimeSpan.FromHours(1), TimeSpan.FromDays(1), and TimeSpan.FromDays(7), respectively.

Given the above comment that @Joe4evr provided, we agree that this wouldn't really be beneficial so I'll go ahead and close this issue for now and would encourage to instead use the alternatives provided on that same comment. @BratulescuMihai feel free to reopen if you still think that there is a proposal that we should consider here.

Was this page helpful?
0 / 5 - 0 ratings