Any class / structure for storing a couple of dates in .NET 2.0 libraries?

Is there a class or structure in the standard .NET 2.0 libraries that will contain two objects DateTime- date and date before? Mostly improved TimeSpan. I can write my structure without problems, but why do this if someone has already done this before?

Notes:

  • TimeSpan By itself, it does not cut, because it contains a time interval, not two dates.
  • Tuple out of the question since it is not available in .NET 2.0
  • KeyValuePair - this is something that I would prefer to avoid, because there is no distinguishable key or value, these are just two dates.
  • DateTime[] - an alternative, yes, but I ask about the structure / class, because if it exists, it can have other useful things.

So, any neat solution that I am missing, or should I just write it myself and / or stop being so picky?

+4
source share
2 answers

You can use class Pair

Visual Basic:

Dim value As Pair(Of String, String) = new Pair(Of String, String) With (foo, bar)

FROM#:

Pair<String, String> value = new Pair<String, String>(foo, bar);

Unverified and there may be typos, it took quite a while, since I worked in either Visual Basic or C #.

More details here .

+1
source

How about a tuple or variation with two dates and an extra double offset.

0
source

All Articles