Check if DateTimeOffset represents the same time and has the same offset as a specified DateTimeOffset object in CSharp
Description
The following code shows how to check if DateTimeOffset represents the same time and has the same offset as a specified DateTimeOffset object.
Example
using System;//from w ww . ja va 2 s.c o m
public class MainClass{
public static void Main(String[] argv){
DateTimeOffset instanceTime = new DateTimeOffset(2014, 10, 31, 0, 0, 0,
DateTimeOffset.Now.Offset);
DateTimeOffset otherTime = instanceTime;
Console.WriteLine("{0} = {1}: {2}",
instanceTime, otherTime,
instanceTime.EqualsExact(otherTime));
}
}
The code above generates the following result.