Assuming date is not a DateTime but a custom class/struct, I don't like the idea of having to new() one every time you want a string value. IMO, a hashmap/dictionary is really the easiest option.
Edit: C# offers ToString overloads with formatting for numerics as well.
View all comments
Show parent comment
3
u/rustyredditortux Nov 11 '21
I didn't know c#'s to string method could format dates, that's actually a relatively elegant solution considering the alternatives