Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compare SQL timestamp in .NET?

I have mapped Entity framework entities. Each table in SQL Server 2008 contains Timestamp column which is mapped as byte array. The length of array is always 8.

Now I need to compare timestamp values in .NET. I come with two solutions but I don't know which one is better?

  • Compare it as arrays. When first pair of bytes is different return false.
  • Convert byte array to long, compare longs.

Which solution is better? Or is there any other solution?

like image 386
Ladislav Mrnka Avatar asked Jan 12 '11 17:01

Ladislav Mrnka


1 Answers

We do it by comparing them as byte arrays. Works fine for us.

like image 200
Randy Minder Avatar answered Sep 21 '22 16:09

Randy Minder