将 GUID 转换为 System.Drawing.Imaging.ImageFormat

发布于 2024-08-27 03:56:50 字数 352 浏览 5 评论 0 原文

我将有关图像的信息存储在数据库中 - 还有它们的图像格式(jpeg、png 等)。

Console.WriteLine(System.Drawing.Imaging.ImageFormat.Jpeg.Guid);  

Outputs: b96b3cae-0728-11d3-9d7b-0000f81ef32e

我想将其作为 GUID 存储在数据库中 - 并从数据库中读取并获取关联的 ImageFormat。

如何投射 GUID b96b3cae-0728-11d3-9d7b-0000f81ef32e 到 System.Drawing.Imaging.ImageFormat.Jpeg.Guid ?

I store information about images in a database - also their ImageFormat (jpeg, png etc).

Console.WriteLine(System.Drawing.Imaging.ImageFormat.Jpeg.Guid);  

Outputs: b96b3cae-0728-11d3-9d7b-0000f81ef32e

I want to store this in the database as a GUID - and read from the database and get the associated ImageFormat.

How do I cast the GUID
b96b3cae-0728-11d3-9d7b-0000f81ef32e
to
System.Drawing.Imaging.ImageFormat.Jpeg.Guid
?

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

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

发布评论

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

评论(3

落日海湾 2024-09-03 03:56:50

您向System.Drawing.Imaging.ImageFormat构造函数,您可以使用它是 Guid 属性。

System.Guid 有多个构造函数,其中包括字符串 构造函数。

You provide a System.Guid to the System.Drawing.Imaging.ImageFormat's constructor, and you can read it back using it's Guid property.

A System.Guid has several constructors, including a string constructor.

软糖 2024-09-03 03:56:50

1) 将 GUID 存储在数据库中而不是 JPEG

2) 使用构造函数:

ImageFormat(
    Guid guid
)

1) store GUID in a database instead of JPEG

2) use constructor:

ImageFormat(
    Guid guid
)
悲喜皆因你 2024-09-03 03:56:50

ImageFormat 的构造函数 不让你通过它的 Guid 得到了 ImageFormat 吗?

Doesn't ImageFormat's constructor let you get the ImageFormat by its Guid?

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