Check if DateTimeOffset object represents the same point in time as a specified object in CSharp
Description
The following code shows how to check if DateTimeOffset object represents the same point in time as a specified object.
Example
using System;/* ww w . ja v a2 s .co m*/
public class MainClass{
public static void Main(String[] argv){
DateTimeOffset firstTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0,
new TimeSpan(-7, 0, 0));
object secondTime = firstTime;
Console.WriteLine("{0} = {1}: {2}",
firstTime, secondTime,
firstTime.Equals(secondTime));
}
}
The code above generates the following result.