convert a byte array to an integer
Published: 13. December 2008 | Updated: 26. October 2011License: Microsoft Public License (MS-PL)
Categories: Converting » Numbers
Tags: C# Conversion
byte[] bytesArray = { 0, 0, 1, 0 }; if (BitConverter.IsLittleEndian) { Array.Reverse(bytesArray); } int number = BitConverter.ToInt32(bytesArray, 0); Console.WriteLine(number);Console Output:
256
| Send us feedback about this snippet » |





