.NET DateTime Does Not Have a Predefined Size
问题 Since DateTime is a struct with members that appear to break down into simple mathematical values, I'm not sure why using sizeof() on it produces the message in the question title. 回答1: Because the CLR can only determine the size at runtime... one of the reasons for this is "padding" (platform dependent)... For all other types, including structs, the sizeof operator can be used only in unsafe code blocks. Although you can use the Marshal.SizeOf method, the value returned by this method is not