I want to store a timestamps in memory (billions of values). The main operations are read-to-memory and read-from-memory, no need in DateTime-specific methods. For compatibility with other services, I want to use unix timestamp format in seconds (to avoid conversions).
So, I want to use special data type instead of just long
in my code.
I found that I can not "make alias name" for simple data type like long
, which I can fully use outside assembly.
So, I want to implement Timestamp as struct with single long
field and some methods (ex, ToDateTime, some operator overloading, etc.), because structs are "non-reference data type" and they keep my memory.
Is making a struct is bad idea?
Any alternatives to make code strongly-typed, to redefine Method (long, long)
to Method (Timestamp, StepCount)