gpt4 book ai didi

c# - 将内部枚举 'TileLayoutIndex' 转换为 int

转载 作者:太空宇宙 更新时间:2023-11-03 13:07:25 25 4
gpt4 key购买 nike

我收到有关转换为 int 的错误消息。

代码如下:

// create the object containing the page content to be set
PageData pageContent = new PageData(
messagesPageGuid,
TileLayoutIndex.MessagesLayout, // Specify which layout to use for this page
new WrappedTextBlockData(
(Int16)TileMessagesLayoutElementId.Message1,
"This is the text of the first message"),
new WrappedTextBlockData(
(Int16)TileMessagesLayoutElementId.Message2,
"This is the text of the second message"));

这是内部枚举代码:

internal enum TileLayoutIndex
{
MessagesLayout = 0,
};

为什么会出现错误?

更新:

Guid messagesPageGuid = Guid.NewGuid();

// create the object containing the page content to be set
PageData pageContent = new PageData(
messagesPageGuid,

这个 Guid 东西可能是问题所在

最佳答案

你没有使用整数,所以你需要转换它:

// create the object containing the page content to be set
PageData pageContent = new PageData(
messagesPageGuid,
(int)TileLayoutIndex.MessagesLayout, // Specify which layout to use for this page

关于c# - 将内部枚举 'TileLayoutIndex' 转换为 int,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30291834/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com