Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 8 必须将FlagsAttribute应用于UInt32枚举_Windows 8_Microsoft Metro - Fatal编程技术网

Windows 8 必须将FlagsAttribute应用于UInt32枚举

Windows 8 必须将FlagsAttribute应用于UInt32枚举,windows-8,microsoft-metro,Windows 8,Microsoft Metro,在阅读了Windows 8应用程序认证要求后,我想知道为什么他们会这样说: •必须将FlagsAttribute应用于UInt32枚举 •不得将FlagsAttribute应用于Int32枚举 背后的原因是什么 当前可以在找到认证要求。WinRT中使用枚举有两种情况:作为枚举值常量和作为位字段值常量。枚举值形式表示为有符号整数(因为它是枚举的),位字段形式表示为无符号整数(以允许所有32位用于标志)。所有位字段枚举都需要具有FlagsAttribute 验证逻辑中的此规则强制执行给定FlagsA

在阅读了Windows 8应用程序认证要求后,我想知道为什么他们会这样说:

•必须将FlagsAttribute应用于UInt32枚举

•不得将FlagsAttribute应用于Int32枚举

背后的原因是什么


当前可以在

找到认证要求。WinRT中使用枚举有两种情况:作为枚举值常量和作为位字段值常量。枚举值形式表示为有符号整数(因为它是枚举的),位字段形式表示为无符号整数(以允许所有32位用于标志)。所有位字段枚举都需要具有FlagsAttribute

验证逻辑中的此规则强制执行给定FlagsAttribute值的枚举的基础类型是正确的


这一点很重要,因为如果枚举的基础类型已签名,某些语言投影将无法正确使用带有FlagsAttribute的枚举。

在WinRT中使用枚举有两种情况:作为枚举值常量和作为位字段值常量。枚举值形式表示为有符号整数(因为它是枚举的),位字段形式表示为无符号整数(以允许所有32位用于标志)。所有位字段枚举都需要具有FlagsAttribute

验证逻辑中的此规则强制执行给定FlagsAttribute值的枚举的基础类型是正确的

这一点很重要,因为如果枚举的基础类型已签名,则某些语言投影将无法正确使用带有FlagsAttribute的枚举