这是对DateTime 和 TimeSpan的增强版。
Time Period Library for .NET
When implementing some software for another project, I came across several requirements involving calculations with time periods. These calculations were an important part of the solution and had high demands in respect to the correctness and accuracy of the results.
The required functionality covered the following areas:
Support for individual time periods
Working with calendar periods within calendar years
Working with calendar periods deviating from the calendar year (fiscal or school periods)
Working with the broadcast calendar
The time calculations should be made available to both server components (Web Services and tasks) as well as for a rich client (Silverlight).
Analyzing the situation brought me to the conclusion that neither the components of the .NET Framework (which I didn't expect) nor any other available tools would cover all the requirements. Because I already encountered similar needs in earlier projects, I decided to develop a generic library for this purpose.
From several development cycles resulted the following library Time Period, which is now available for the following .NET runtime environments:
.NET Framework from Version 2
.NET Framework for Silverlight from Version 4
AssemblyInfo.cs VersionInfo.cs Default.aspx Silverlight.js TimePeriod_en.pdf ViewModel.cs TimeSpanConverter.cs TimePeriodObservableCollection.cs TimePeriodMode.cs MainPage.xaml.cs