Chapter 22. Time & Dates

Working with times and dates is a common task. You may want to check if a file has changed since last you looked, test how long an operation takes to complete, or work out some kind of schedule for future activities. C# and the .NET Framework Class Library have extensive support for measuring and managing time and dates. This chapter starts with support for measuring small amounts of time very accurately and moves on to the mainstays of time representation, the System.TimeSpan and System.DateTime structures. Table 22-1 provides the summary for this chapter.

Table 22-1. Quick Problem/Solution Reference for Chapter 22

Problem

Solution

Listings

Measure how long an activity takes.

Use the StopWatch class.

22-1, 22-2

Represent a period ...

Get Introducing Visual C# 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.