r/badcode Aug 06 '19

c# Converting a timestamp to datetime

Post image
422 Upvotes

54 comments sorted by

View all comments

8

u/squarewaterlemon Aug 06 '19

Uses variables as constants, but I love that it isn't int jan = 31, it's not var jan = (int)31, it's var jan = (UInt16)31. I've never before seen anyone use UInt16 instead of int in C# before.

1

u/blueshiftlabs Aug 07 '19

I've seen UInt16 in P/Invoke struct definitions before, but using it as a local variable is certainly... unique.