I have a byte array value of 10 elements taken from an sql_variant
column in my database table and would like to convert it to a long value. I tried this.
byte []a = new byte[10]{ 127, 1, 0, 202, 154, 59, 0, 0, 0, 0 };
long i = BitConverter.ToInt64(a, 0);
Console.WriteLine("{0}", i);
but it's not giving me the correct result. I expect it to be 10000000000
.
Thank you if you could offer me some ideas of classes or methods in C# I can look up into.