A type for Date only in C# - why is there no Date type?

In our C# project we have the need for representing a date without a time. I know of the existence of the DateTime, however, it incorporates a time of day as well. I want to make explicit that certain variables and method-arguments are date-based. Hence I can't use the DateTime.Date property

What are the standard approaches to this problem? Surely I'm not the first to encounter this? Why is there no Date class in C#?

Does anyone have a nice implementation using a struct and maybe some extensionmethods on DateTime and maybe implementing some operators such as == and <, > ?

94
задан Carlo V. Dango 15 March 2011 в 16:06
поделиться