我收到有关转换为 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/