字段类型字段,用于存储一个长序列号(10字节) [英] DataType for storing a long serial number (10 bytes)

查看:125
本文介绍了字段类型字段,用于存储一个长序列号(10字节)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们必须有,必须读入我们的应用程序,并存储成.NET数据类型的10个字节序列号的设备。在该装置它存储为一个无符号的10字节(80位)的数。我不希望我们将要执行此数字任何数学运算,但只有它显示给用户。

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.

在.NET框架不具有内置的UNIT128 存储该数据类型。我的建议,用于存储该数据类型是创建一个10元的字节数组,并读取数据到这个数组中。有没有更好的办法解决这一问题呢?

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?

注:我已经看到了<一个href="http://stackoverflow.com/questions/1732780/simulate-a-128-bit-unsigned-integer-in-sql-and-c-using-a-64-bit-signed-value/1732818#1732818">this问题的一个GUID是一个128字节有符号整数,但它似乎是一个坏主意,使用GUID以这种方式。任何其他建议?

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?

推荐答案

您应该使用一个字节数组。

You should use a byte array.

这篇关于字段类型字段,用于存储一个长序列号(10字节)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆