In C#, what is the difference between comparing two dates using tick and just as it is

Is this a more accurate way of comparing DateTime?

Not in the slightest. In fact, that is how the > operator is implemented internally.

From the .NET Reference source:

public static bool operator >(DateTime t1, DateTime t2) {
    return t1.InternalTicks > t2.InternalTicks;
}

Someone might have thought they were being clever by skipping the one line of internal code and going straight to the Ticks property. In reality, the getter for Ticks returns InternalTicks, so unless it is optimized by the compiler, using the Ticks property adds two calls in order to save one call (neither of which would change the performance significantly).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)