Created
July 3, 2013 15:55
-
-
Save jonsagara/5919700 to your computer and use it in GitHub Desktop.
Convert a SQL Server version to a byte array in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hexNum = "0x000000000000E295"; | |
long result; | |
long.TryParse( | |
hexNum.Substring(2), | |
System.Globalization.NumberStyles.HexNumber | System.Globalization.NumberStyles.AllowHexSpecifier, | |
System.Globalization.CultureInfo.CurrentCulture, | |
out result | |
); | |
//result.Dump(); | |
var resultBytes = BitConverter.GetBytes(result); | |
resultBytes.Reverse().Dump(); | |
resultBytes[0].Dump(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment