在 C# 中读取 Java UUID(从 DB)

发布于 2024-08-25 00:43:58 字数 98 浏览 5 评论 0原文

我正在尝试将一个表(其中一列是二进制数组(Java UUID))映射到 C# 类。

我想读取字节数组并返回 UUID 的字符串表示形式。只是想知道什么是一个好的起点。

I'm trying to map a table, where one of the column is a binary array (which is a Java UUID), to a C# class.

I would like to read the byte array and return a string representation of the UUID. Just wondering what's a good place to start.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我很坚强 2024-09-01 00:43:58

如果您已经将其作为字节数组,则只需调用 new Guid(bytes) 获取 Guid;如果您特别需要,可以对其调用 ToString 将其转换为字符串。 (我建议将其保留为 Guid,但除了诊断之外。)

If you've already got it as a byte array, then just call new Guid(bytes) to get a Guid; you can call ToString on that to convert it to a string if you particularly need to. (I'd suggest leaving it as a Guid though other than for diagnostics.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文