DateTime.Inequality(DateTime, DateTime) DateTime.Inequality(DateTime, DateTime) DateTime.Inequality(DateTime, DateTime) DateTime.Inequality(DateTime, DateTime) Operator

定义

确定 DateTime 的两个指定的实例是否不等。Determines whether two specified instances of DateTime are not equal.

public:
 static bool operator !=(DateTime d1, DateTime d2);
public static bool operator != (DateTime d1, DateTime d2);
static member op_Inequality : DateTime * DateTime -> bool
Public Shared Operator != (d1 As DateTime, d2 As DateTime) As Boolean

参数

d1
DateTime DateTime DateTime DateTime

要比较的第一个对象。The first object to compare.

d2
DateTime DateTime DateTime DateTime

要比较的第二个对象。The second object to compare.

返回

如果 trued1 不表示同一日期和时间,则为 d2;否则为 falsetrue if d1 and d2 do not represent the same date and time; otherwise, false.

注解

@No__t-0 运算符通过比较两个 @no__t 值的计时周期数来确定这两个值是否不相等。The Inequality operator determines whether two DateTime values are not equal by comparing their number of ticks. 在比较 DateTime 对象之前,请确保对象表示相同时区中的时间。Before comparing DateTime objects, make sure that the objects represent times in the same time zone. 可以通过比较其 Kind 属性的值来执行此操作。You can do this by comparing the values of their Kind property.

此运算符的等效方法为 DateTime.Equals(Object)The equivalent method for this operator is DateTime.Equals(Object)

适用于

另请参阅