C# DateTimeOffset Equals(DateTimeOffset, DateTimeOffset)
Description
DateTimeOffset Equals(DateTimeOffset, DateTimeOffset)
determines
whether two specified DateTimeOffset objects represent the same point
in time.
Syntax
DateTimeOffset.Equals(DateTimeOffset, DateTimeOffset)
has the following syntax.
public static bool Equals(
DateTimeOffset first,
DateTimeOffset second
)
Parameters
DateTimeOffset.Equals(DateTimeOffset, DateTimeOffset)
has the following parameters.
first
- The first object to compare.second
- The second object to compare.
Returns
DateTimeOffset.Equals(DateTimeOffset, DateTimeOffset)
method returns true if the two DateTimeOffset objects have the same UtcDateTime value;
otherwise, false.
Example
The following example illustrates calls to the Equals(DateTimeOffset, DateTimeOffset) method.
// w w w .jav a 2 s .c o m
using System;
public class MainClass{
public static void Main(String[] argv){
DateTimeOffset firstTime = new DateTimeOffset(2014, 11, 15, 11, 35, 00,
DateTimeOffset.Now.Offset);
DateTimeOffset secondTime = firstTime;
Console.WriteLine("{0} = {1}: {2}",
firstTime, secondTime,
DateTimeOffset.Equals(firstTime, secondTime));
}
}
The code above generates the following result.