C# DateTimeOffset EqualsExact
Description
DateTimeOffset EqualsExact
determines whether the
current DateTimeOffset object represents the same time and has the same
offset as a specified DateTimeOffset object.
Syntax
DateTimeOffset.EqualsExact
has the following syntax.
public bool EqualsExact(
DateTimeOffset other
)
Parameters
DateTimeOffset.EqualsExact
has the following parameters.
other
- The object to compare to the current DateTimeOffset object.
Returns
DateTimeOffset.EqualsExact
method returns true if the current DateTimeOffset object and other have the same date and
time value and the same Offset value; otherwise, false.
Example
The following example illustrates the use of the EqualsExact method to compare DateTimeOffset object.
using System;// w ww . ja va 2s. c om
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.