Search code examples
c#.nettypesunsigned128-bit

DataType for storing a long serial number (10 bytes)


We have a device which has a 10 byte serial number which must be read into our application and stored into a .net datatype. In the device it is stored as an unsigned 10-byte (80-bit) number. I don't expect we will be performing any mathematical operations on this number, but only displaying it to the user.

The .NET framework doesn't have a built in UNIT128 to store this datatype. My suggestion for storing this datatype is to create a 10 element byte array and read in the data into this array. Are there any better solutions to this problem?

Note: I have seen in this question that a GUID is a 128 byte signed integer, but it seems like a bad idea to use a GUID in this fashion. Any other suggestions?


Solution

  • You should use a byte array.