I have a SQL Server 2012 database. Each table has a set of audit fields. One is a column named RowVer with a datatype of timestamp
(same as rowversion
One option is to handle this at the SQL level with the CONVERT() function, where it maps nicely to BIGINT:
CONVERT(BIGINT, MyRowVersionColumn)
And now you can read it easily into an Int64:
user.RowVersion = rdr.GetInt64(18);
That will, of course, mean changing the datatype of your object, but you may that this is a good thing.
If you want to keep the byte array, you can do this:
rdr.GetBytes(18, 0, user.RowVersion, 0, rdr.GetBytes());
Or, since the length of the field is known:
rdr.GetBytes(18, 0, user.RowVersion, 0, 8);